Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Adding point as extended data

3 REPLIES 3
Reply
Message 1 of 4
200900436
327 Views, 3 Replies

Adding point as extended data

Hi all,

 

I was trying to add a point as extended data to a block.

Therefor i used this data but i get an error every time:

 

(setq lastent (entget (CAR (entsel))))
(regapp "list")
(setq exdata '((-3
		("list"
		 (1011 . 3277.82)
		 (1021 . 5782.5)
		 (1031 . 369.5)
		 
		)
	       )
	      )
)
(setq newent
       (append lastent exdata)
)
(entmod newent)

 

Can somebody tell me what went rong?

 

Regards

 

Thomas

3 REPLIES 3
Message 2 of 4
dgorsman
in reply to: 200900436

Assuming the DXF codes are capable of supporting double value types, you aren't creating a list of dotted pairs.  I think the XDATA identifier also needs a DXF code.  You'll need a single-quote on the list if the first element is intended to be the string "list", or use the (list... ) function to construct one on the fly.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


Message 3 of 4
southie
in reply to: 200900436

Maybe this can help

 

(setq e (entlast))

 

(entmod (list (cons -1 e)  '(-3 ("list"  (1011 . 3277.82)  (1021 . 5782.5)  (1031 . 369.5)

 

))))

 

southie

Message 4 of 4
200900436
in reply to: southie

I player around a litle whit my function but still can't find the problem.

When i set the list of items i want to add as folows it works perfect

 

(setq exdata				; Sets the variable
       '((-3
	  ("list"			; exdata equal to the
	   (1041 . 3203.59)		; new extended data—
	   (1041 . 1106.68)
	   (1041 . 0.0)
	  )
	 )
	)				
)		

 But if i want to use group code 1011 (world space position) it doesn't work.

When i want to use it i get the error:

 

; error: bad DXF group: (-3 ("aansluitingen" (1011 . 3203.59)))

 

(setq exdata				; Sets the variable
       '((-3
	  ("list"			; exdata equal to the
	   (1011 . 3203.59)		; new extended data—
	   (1021 . 1106.68)
	   (1031 . 0.0)
	  )
	 )
	)				
)

 

And this is the complete code i use now:

 

(setq lastent (entget (car (entsel))))	; Gets the association
					; list of definition data
					; for the last entity.
(regapp "list")				; Registers the
					; application name.
(setq exdata				; Sets the variable
       '((-3
	  ("list"			; exdata equal to the
	   (1011 . 3203.59)		; new extended data—
	   (1021 . 1106.68)
	   (1031 . 0.0)
	  )
	 )
	)				; in this case, a text
)					; string.
(setq newent
       (append lastent exdata)
)					; Appends new data list to
					; entity's list.
(entmod newent)				; Modifies the entity with the
new
					; definition data.

 

Regards

 

Thomas

 

P.S.: thanks for olready looking at the problem

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost