Guys, I am new, this is my first post. I am working with a plugin to CAD for plumbing and duct. I am trying to extract the XYZ coordinates and insert a block at the Endpoint.
Basically, how can I truncate the list of XYZ values in the image and only keep the first?
Below is as far as I've gotten. Any thoughts or directions would be appreciated!
(defun c:mapend (/ data ent pt-lst pt-str start vla ctr nme dscr2)
(svars)
(setvar "osmode" 0)
(setvar "orthomode" 0)
(setvar "cmdecho" 0)
(mapfilter "#39 = 2882" 0 0 1)
(while
(setq ent (ssget))
(setq ctr 0)
(repeat (sslength ent)
(setq nme (ssname ent ctr))
(setq vla (vlax-ename->vla-object nme))
;; Ip Points data exists, and Midpoint is included
(if (and (setq data (vlax-get-property vla "Points"))
(setq start (vl-string-search "ENDPOINTS:" (strcase data)))
(setq svcnm (vlax-get-property vla "ServiceName"))
)
(progn
;; Set Midpoint (as String)
(setq pt-str (vl-string-trim "ENDPONITS:" data))
----truncate coordinates here----
(alert pt-str)
;; Set Midpoint (as List)
(setq pt-lst2 (read (vl-string-translate "," " " (strcat "(" pt-str ")"))))
)
);endif
(command "_insert" "*N:\\1_CAD Department\\700_CADMEP_BD\\Porter Database\\Templates\\Blocks\\ChangePoint.dwg" pt-lst "" "")
(setq new (ssget "l"))
(setq f (open "N:\\1_CAD Department\\700_CADMEP_BD\\tmp.cod" "w"))
(setq script (strcat "item.service =" "\""svcnm "\""))
(write-line script f)
(close f)
(executescript "N:\\1_CAD Department\\700_CADMEP_BD\\tmp.cod" new)
(setq ctr (1+ ctr))
);end repeat
);end while
(rvars)
(princ)
)
;enddefun