Fill out polyline attribute based on block snapped to start and end point

Fill out polyline attribute based on block snapped to start and end point

cherrygate
Enthusiast Enthusiast
206 Views
1 Reply
Message 1 of 2

Fill out polyline attribute based on block snapped to start and end point

cherrygate
Enthusiast
Enthusiast

Hi all,

 

I am struggling a bit with this one - I am trying to fill out object data table attributes of many polylines and lines based on the point it starts and ends at. The line it starts at is a block with an attribute + OD data (both have the data we need) - and the line ends at at similar block with an attribute + data table. The blocks should be exactly snapped to the start/end points.

 

I have attached an example DWG below - the "ID" from the "pole" block should go into the "start_spli" of the line, and the "addresslin" from the "house" block should go into the "end_splice" of the line.

 

I really appreciate any help with this, thank you!!

 

DWG: https://drive.google.com/file/d/1uYcjKZ-f-7IKqWCK_g7KzGEZu6kgIvrM/view?usp=sharing

0 Likes
207 Views
1 Reply
Reply (1)
Message 2 of 2

Sea-Haven
Mentor
Mentor

I think I wrote this based on examples at Afralisp, should be a case of changing get to put.

 

; simple object data example
; By Alan H July 2019

(defun c:odtest ( / ent ty odname dia material)
(setq ent (car (entsel "\n Select Polyline (or press Enter to Exit): ")))
(setq ty (cdr (assoc 0 (entget ent))))
	(if (and (eq "LWPOLYLINE" ty)
	  (/= (setq odname (ade_odgettables ent)) nil)
	   )
	 (progn
           (setq dia (ade_odgetfield ent odname "Diameter" 0))
           (setq mat (ade_odgetfield ent odname "Material" 0))
           (alert (strcat "Material: " mat " \nDiameter " (rtos dia 2 2) (chr 34) " Main"))
           )
         )
(princ)
)
(c:odtest)
0 Likes