Hello, I'm not a programmer but I dabble a bit. I looking to write a program where you pick your alignment then pick your civil 3d point, it then edits the raw description of civil point to include that station.
It does not need to insert the alignment label I just need the stationing from it. I have some bits and pieces of code but nothing that all makes sense together. I really could use a hand on this one. Much Appreciated.
Solved! Go to Solution.
Solved by Jeff_M. Go to Solution.
Solved by Jeff_M. Go to Solution.
hello
try
(defun c:testStationlign (/ align bearing dist east idx inrange north off os pt ptent range ssalign sspts sta)
(if (and
(princ "\Select points: ")
(setq sspts (ssget '((0 . "AECC_COGO_POINT"))))
(princ "\nSelect alignment: ")
(setq ssalign (ssget ":S" '((0 . "AECC_ALIGNMENT"))))
)
(progn
(setq
idx -1
align (vlax-ename->vla-object (ssname ssalign 0))
)
(while (setq ptent (ssname sspts (setq idx (1+ idx))))
(setq pt (vlax-ename->vla-object ptent)
east (vlax-get pt 'easting)
north (vlax-get pt 'northing)
)
;;http://docs.autodesk.com/CIV3D/2012/ENU/API_Reference_Guide/com/AeccXLandLib__IAeccAlignment__StationOffsetEx@[in]_double@[in]_double@[in]_double@[out]_double_@[out]_double_@[out,_retval]_AeccAlignmentReturnValue_.htm
(if (= 0 (setq inrange (vlax-invoke-method align 'stationoffsetex east north 0.0001 'sta 'off)))
(progn
(vlax-put-property pt 'LabelStyle "Point#-Elevation-Description")
(vla-put-description pt (strcat "Station =" (RTOS sta 2 3 )))
)
)
)
)
)
(princ)
)
This little lisp has you select an alignment, then it prompts to select points, it will continue as long as you select a point.
(defun c:sta2desc(/ ALIGN ALNENT DESC I OFF PT PTSS STA STATION)
(if (and (setq alnEnt (entsel "\nSelect alignment: "))
(setq align (vlax-ename->vla-object (car alnEnt)))
(= (vla-get-objectname align) "AeccDbAlignment")
)
(progn
(while (setq ptSS (ssget '((0 . "AECC_COGO_POINT"))))
(setq i -1)
(while (setq pt (vlax-ename->vla-object (ssname ptSS (setq i (1+ i)))))
(setq sta nil
off nil)
(vlax-invoke-method align 'stationoffset (vlax-get pt 'easting) (vlax-get pt 'northing) 'sta 'off)
(if (/= nil sta)
(progn
(setq station (vlax-invoke align 'getstationstringwithequations sta))
(setq desc (strcat (vlax-get pt 'rawdescription) "|" station))
(vlax-put pt 'rawdescription desc)
)
)
)
)
)
)
(princ)
)
Amazing Jeff, I just have to round the sta to nearest ft now.
Any fast way to round a sta with the + in it to nearest ft? I tried converting to a real number then back to a string after rounding but that didn't work. Instead of using getstationstringwithequations should I use something else to give me a real number I can round? getstationstring ?
Can't find what you're looking for? Ask the community or share your knowledge.