Kowal 发表于 2022-7-6 06:42:29

[Autolisp, Civil 3D] Convert s

Hello all.
is my first post on this forum.
I have a question on how to convert Station and offset on xy coordinates.
Differently than is shown on this page.
http://cadpanacea.com/node/187
Code of this page

; standard entity selection(setq sel (entsel "\nSelect Alignment: ")); get the entity name(setq ent (car sel)); get the entity list(setq lst (entget ent)); check to make sure the selection was the expected type(if (eq "AECC_ALIGNMENT" (cdr (assoc 0 lst))) ; if so, convert the entity into a VLA-OBJECT (setq obj (vlax-ename->vla-object ent)))(if obj (progn   ; get the name of the alignment   (setq nam (vlax-get-property obj 'Name))   ; get the start station   (setq sta1 (vlax-get-property obj 'StartingStation))   ; get the end station   (setq sta2 (vlax-get-property obj 'EndingStation))   ; set a couple of variables   (setq sta 100.0 off 10.0)   ; using the above variables, find this point on the alignment   (vlax-invoke-method obj 'PointLocation sta off 'x 'y)   ; create an AutoCAD point at this location   (entmake (list (cons 0 "POINT")(cons 10 (list x y))))   ; ask the user to pick a point   (setq pt1 (getpoint "\nSelect point: "))   ; find the station and offset for this point   (vlax-invoke-method obj 'StationOffset (car pt1) (cadr pt1) 'sta 'off)   ; inform the user   (alert (strcat         "The station is "         (rtos sta 2 2)         "\nThe offset is "         (rtos off 2 2))) ))

BlackBox 发表于 2022-7-6 07:31:49

Are you wanting to convert Station and Offset to XY, or XY to Staion and Offset?

Kowal 发表于 2022-7-6 07:52:02

Station and Offset to xy.
页: [1]
查看完整版本: [Autolisp, Civil 3D] Convert s