Jump to content

Recommended Posts

Posted

I made below lisp code to have field code copied to text,dim etc.

but not work on ATT thing

anyone could help me with this

how to make it happen that copy field code to ATT? :):):)

(defun c:ffd ()
(progn
	(setvar "cmdecho" 0)
	(setvar "blipmode" 0)
	(vl-load-com)
	(progn
		(setq ent (entsel "select text to be copied:"))
		(setq egg (cdr (assoc 0 (entget (car ent)))))
		(setq entx (vlax-ename->vla-object (car ent))) 
		(cond
			((= egg "INSERT")				
				(setq entp (entget (car (nentselp (cadr ent)))))
				(setq entr (cdr (assoc -1 entp)))
				(setq objid (vla-get-objectid (vlax-ename->vla-object entr)))
				(setq field (strcat "%<\\AcObjProp Object(%<\\_ObjId " (itoa objid) ">%).TextString>%"))
				;                    %<\AcObjProp Object(%<\_ObjId 8796059764128>%).TextString>%
				;                    %<\AcObjProp Object(%<\_ObjId 8796083319744>%).TextString>%
			)
			((= egg "DIMENSION")
				(setq objid (vla-get-objectid entx))
				(setq field (strcat "%<\\AcObjProp Object(%<\\_ObjId " (itoa objid) ">%).Measurement \\f \"%lu2\">%"))
			)
		)
		;%<\AcObjProp Object(%<\_ObjId 8796059773904>%).Measurement \f "%lu2">%
		(setq ent1 (entsel "copy to:"))
		(setq egg1 (cdr (assoc 0 (entget (car ent1)))))
		(setq entx1 (vlax-ename->vla-object (car ent1)))
		(cond
			((= egg1 "INSERT")				
				(setq entp (entget (car (nentselp (cadr ent1)))))
				(setq entr (cdr (assoc -1 entp)))
				(vla-put-TextString (vlax-ename->vla-object entr) field)				
			)
			((OR (= egg1 "TEXT") (= egg1 "MTEXT"))
				(vla-put-textstring entx1 field)
			)
			((= egg1 "DIMENSION")
				(vla-put-TextOverride entx1 field)
			)
		)
	)
)	
)

Posted

When populating an attribute with a field expression, you will need to use the UPDATEFIELD command or issue REGEN for the field expression to be correctly displayed - you may wish to refer to Copy Field program for a similar example, or my Length Field program for a more extensive example which operates with a wider range of objects.

Posted

thanks, just put in updatefield ,and all solved, thanks for help:D

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...