ccalder
2016-02-22, 08:52 PM
I may be trying to bite off more than lisp can handle here but here's where I am. I've used a similar version of the snippet below to create TIN surfaces with lisp. Basically I use it to create common surfaces used in every job then use some other code to fill in whatever generic blanks I know I'll need then fill in the unique aspects manually through the prospector. I'm wanting to add the creation of a volume surface into the mix, up till now I've just been doing it manually. I see ways to do what I want with VB.net but I don't have any experience with .net (on the list, I'll get to it someday) and I'm fairly comfortable with lisp. Here's the snippit:
(defun c:vol-surf ( / )
(vl-load-com)
(setq prod (strcat "HKEY_LOCAL_MACHINE\\"
(if vlax-user-product-key
(vlax-user-product-key)
(vlax-product-key)
)
)
prod (vl-registry-read prod "Release")
verstr (substr
prod
1
(vl-string-search "." prod (+ (vl-string-search "." prod) 1))
)
)
(setq prodStr (strcat "AeccXUiLand.AeccApplication." verstr))
(setq datastr (strcat "AeccXLand.AeccTinVolumeCreationData." verstr))
(if (and (setq *acad* (vlax-get-acad-object))
(setq C3D (vla-getinterfaceobject *acad* prodStr))
(setq C3Ddoc (vla-get-activedocument C3D))
(setq surfs (vlax-get C3Ddoc 'surfaces))
(setq tincreationdata
(vla-getinterfaceobject *acad* datastr)
)
)
(progn
(vlax-put tincreationdata 'baselayer "0")
(vlax-put tincreationdata 'BaseSurface (vlax-get-property surfs 'Item "EG"))
(vlax-put tincreationdata 'ComparisonSurface (vlax-get-property surfs 'Item "FG"))
(vlax-put tincreationdata 'layer "SURF-VOL")
(vlax-put tincreationdata 'description "Surface from Lisp")
(vlax-put tincreationdata 'name "VOL")
;;style must exist!
(vlax-put tincreationdata 'style "BORDER TRIANGLES AND POINTS")
(setq surf (vlax-invoke-method surfs
'addtinvolumesurface tincreationdata))
;; do whatever else is needed
(vlax-release-object tincreationdata)
(vlax-release-object surf)
(vlax-release-object surfs)
(vlax-release-object c3ddoc)
)
)
(princ)
)(vlax-get-property surfs 'Item "EG")
Anyhoo, I'm missing something, probably something obvious, in the snippet above. I'm trying to Rosetta stone it from some .net code I found here (http://m.arch-pub.com/Error-when-attempting-to-create-a-Tin-Volume-Surface-with-VB-net_10424871.html) and here (https://knowledge.autodesk.com/support/autocad-civil-3d/learn-explore/caas/CloudHelp/cloudhelp/2015/ENU/Civil3D-DevGuide/files/GUID-AFBAEC7F-052A-4123-8918-1FC729A709A1-htm.html). The problem occurs at line:
(vlax-put tincreationdata 'BaseSurface (vlax-get-property surfs 'Item "EG"))
with error "error: Member not found" so I'm obviously not passing it the expected info for the surface.
I've tried assigning
(vlax-get-property surfs 'Item "EG") to a variable first and still doesn't work.
surfaces "EG" & "FG" do exist in the drawing I'm testing on, just running (vlax-get-property surfs 'Item "EG") does give me an object I can view the properties and methods of.
any help would be greatly appreciated. The grand plan is to be able to grab properties from the created volume surface and use it in further code to automate certain tedious form filling operations that we usually do manually, so I want to avoid .net if I can due to my aforementioned unfamiliarity.
If I've bitten off more than lisp can handle I'd appreciate a heads up. I have the additional stuff I want to do already working as long as the "VOL" surface already exists, so if its a lost cause it's just an extra minute and a half per job to make it manually, not really deal breaking. I could probably steal the .net from the links above and invoke it in the lisp... I've done something similar before, but it feels kludgy.
Thanks!
(defun c:vol-surf ( / )
(vl-load-com)
(setq prod (strcat "HKEY_LOCAL_MACHINE\\"
(if vlax-user-product-key
(vlax-user-product-key)
(vlax-product-key)
)
)
prod (vl-registry-read prod "Release")
verstr (substr
prod
1
(vl-string-search "." prod (+ (vl-string-search "." prod) 1))
)
)
(setq prodStr (strcat "AeccXUiLand.AeccApplication." verstr))
(setq datastr (strcat "AeccXLand.AeccTinVolumeCreationData." verstr))
(if (and (setq *acad* (vlax-get-acad-object))
(setq C3D (vla-getinterfaceobject *acad* prodStr))
(setq C3Ddoc (vla-get-activedocument C3D))
(setq surfs (vlax-get C3Ddoc 'surfaces))
(setq tincreationdata
(vla-getinterfaceobject *acad* datastr)
)
)
(progn
(vlax-put tincreationdata 'baselayer "0")
(vlax-put tincreationdata 'BaseSurface (vlax-get-property surfs 'Item "EG"))
(vlax-put tincreationdata 'ComparisonSurface (vlax-get-property surfs 'Item "FG"))
(vlax-put tincreationdata 'layer "SURF-VOL")
(vlax-put tincreationdata 'description "Surface from Lisp")
(vlax-put tincreationdata 'name "VOL")
;;style must exist!
(vlax-put tincreationdata 'style "BORDER TRIANGLES AND POINTS")
(setq surf (vlax-invoke-method surfs
'addtinvolumesurface tincreationdata))
;; do whatever else is needed
(vlax-release-object tincreationdata)
(vlax-release-object surf)
(vlax-release-object surfs)
(vlax-release-object c3ddoc)
)
)
(princ)
)(vlax-get-property surfs 'Item "EG")
Anyhoo, I'm missing something, probably something obvious, in the snippet above. I'm trying to Rosetta stone it from some .net code I found here (http://m.arch-pub.com/Error-when-attempting-to-create-a-Tin-Volume-Surface-with-VB-net_10424871.html) and here (https://knowledge.autodesk.com/support/autocad-civil-3d/learn-explore/caas/CloudHelp/cloudhelp/2015/ENU/Civil3D-DevGuide/files/GUID-AFBAEC7F-052A-4123-8918-1FC729A709A1-htm.html). The problem occurs at line:
(vlax-put tincreationdata 'BaseSurface (vlax-get-property surfs 'Item "EG"))
with error "error: Member not found" so I'm obviously not passing it the expected info for the surface.
I've tried assigning
(vlax-get-property surfs 'Item "EG") to a variable first and still doesn't work.
surfaces "EG" & "FG" do exist in the drawing I'm testing on, just running (vlax-get-property surfs 'Item "EG") does give me an object I can view the properties and methods of.
any help would be greatly appreciated. The grand plan is to be able to grab properties from the created volume surface and use it in further code to automate certain tedious form filling operations that we usually do manually, so I want to avoid .net if I can due to my aforementioned unfamiliarity.
If I've bitten off more than lisp can handle I'd appreciate a heads up. I have the additional stuff I want to do already working as long as the "VOL" surface already exists, so if its a lost cause it's just an extra minute and a half per job to make it manually, not really deal breaking. I could probably steal the .net from the links above and invoke it in the lisp... I've done something similar before, but it feels kludgy.
Thanks!