Connectpts - 2016 update

Connectpts - 2016 update

Anonymous
Not applicable
746 Views
2 Replies
Message 1 of 3

Connectpts - 2016 update

Anonymous
Not applicable

Can anyone help with updating this LISP routine to run in 2016? It connects points with identical descriptions in ascending point #. I do not know the vl-string-search R code for 2016.

Thanks in advance!

 

;|Platform: AutoCAD Civil 3D
Routine to draw 3dPoly between points with identical descriptions, in ascending Pt# order.
by Jeff Mishler, July 25, 2007. Tested only in C3D2008
|;
(defun c:Connectpts (/ appstr coords desc grps pline point point#s points pt qbldr ss tmpgrp vrsn )
(VL-LOAD-COM)
(setq vrsn (vlax-product-key))
(cond ((vl-string-search "R16.2" vrsn)(setq appstr "3.0"));;2006
((vl-string-search "R19.0" vrsn)(setq appstr "10.0"));;2013
((vl-string-search "R19.1" vrsn)(setq appstr "10.3"));;2014
((vl-string-search "R20.0" vrsn)(setq appstr "10.4"));;2015
(t (alert "This version of C3D not supported!"))
)
(if (and appstr
(or *acad*
(setq *acad* (vlax-get-acad-object))
)
(or *AeccApp*
(setq *AeccApp* (vla-getinterfaceobject *acad*
(strcat "AeccXUiLand.AeccApplication." appstr)))
)
(or *AeccDoc*
(setq *AeccDoc* (vlax-get *AeccApp* 'ActiveDocument))
)
(setq ss (ssget ":S:E" '((0 . "AECC_COGO_POINT"))))
)
(progn
(setq pt (vlax-ename->vla-object (ssname ss 0))
desc (vlax-get pt 'RawDescription)
grps (vlax-get *AeccDoc* 'PointGroups)
tmpgrp (vlax-invoke grps 'Add "__TEMP__")
)
(setq qbldr (vlax-get tmpgrp 'querybuilder))
(vlax-put qbldr 'IncludeRawDescriptions desc)
(if (> (length (setq points (vlax-get tmpgrp 'Points))) 1)
(progn
(setq point#s (vl-sort points '<))
(setq points (vlax-get *AeccDoc* 'Points))
(foreach pt# point#s
(setq point (vlax-invoke points 'Find pt#))
(setq coords (append coords (list (vlax-get point 'Easting)
(vlax-get point 'Northing)
(vlax-get point 'Elevation)
)))
)
(setq pline (vlax-invoke (vla-get-modelspace *AeccDoc*) 'Add3dPoly coords))
(vla-put-layer pline (vlax-invoke *aeccdoc* 'getvariable "Clayer"))
)
)
(vlax-invoke qbldr 'clear)
(vlax-invoke grps 'remove "__TEMP__")
)
)
(princ)
)

 

 

0 Likes
747 Views
2 Replies
Replies (2)
Message 2 of 3

Shneuph
Collaborator
Collaborator

Enter (vlax-product-key) into your commandline.  If it doesn't work enter (vl-load-com) then try again.  It'll give you the number to search for.  Obviously, the program should be tested with the new version to be sure it functions properly.

---sig---------------------------------------
'(83 104 110 101 117 112 104 64 71 109 97 105 108 46 99 111 109)
Message 3 of 3

Anonymous
Not applicable

Found the right version info for 2016. Below LISP now tested and works in 2016.

 

;|Platform: AutoCAD Civil 3D
Routine to draw 3dPoly between points with identical descriptions, in ascending Pt# order.
by Jeff Mishler, July 25, 2007. Tested only in C3D2008
|;
(defun c:Connectpts (/ appstr coords desc grps pline point point#s points pt qbldr ss tmpgrp vrsn )
(VL-LOAD-COM)
(setq vrsn (vlax-product-key))
(cond ((vl-string-search "R16.2" vrsn)(setq appstr "3.0"));;2006
((vl-string-search "R19.0" vrsn)(setq appstr "10.0"));;2013
((vl-string-search "R19.1" vrsn)(setq appstr "10.3"));;2014
((vl-string-search "R20.0" vrsn)(setq appstr "10.4"));;2015
((vl-string-search "R20.1" vrsn)(setq appstr "10.5"));;2016
(t (alert "This version of C3D not supported!"))
)
(if (and appstr
(or *acad*
(setq *acad* (vlax-get-acad-object))
)
(or *AeccApp*
(setq *AeccApp* (vla-getinterfaceobject *acad*
(strcat "AeccXUiLand.AeccApplication." appstr)))
)
(or *AeccDoc*
(setq *AeccDoc* (vlax-get *AeccApp* 'ActiveDocument))
)
(setq ss (ssget ":S:E" '((0 . "AECC_COGO_POINT"))))
)
(progn
(setq pt (vlax-ename->vla-object (ssname ss 0))
desc (vlax-get pt 'RawDescription)
grps (vlax-get *AeccDoc* 'PointGroups)
tmpgrp (vlax-invoke grps 'Add "__TEMP__")
)
(setq qbldr (vlax-get tmpgrp 'querybuilder))
(vlax-put qbldr 'IncludeRawDescriptions desc)
(if (> (length (setq points (vlax-get tmpgrp 'Points))) 1)
(progn
(setq point#s (vl-sort points '<))
(setq points (vlax-get *AeccDoc* 'Points))
(foreach pt# point#s
(setq point (vlax-invoke points 'Find pt#))
(setq coords (append coords (list (vlax-get point 'Easting)
(vlax-get point 'Northing)
(vlax-get point 'Elevation)
)))
)
(setq pline (vlax-invoke (vla-get-modelspace *AeccDoc*) 'Add3dPoly coords))
(vla-put-layer pline (vlax-invoke *aeccdoc* 'getvariable "Clayer"))
)
)
(vlax-invoke qbldr 'clear)
(vlax-invoke grps 'remove "__TEMP__")
)
)
(princ)
)

0 Likes