Jump to content

How to copy a dictionary from one entity to a new one?


Semx11

Recommended Posts

We've build a lisp code to replace imported Arcgis points to the correct cad block defined by our national standard.

 

We do this by creating a new block using entmake:

(setq $entList (list
    '(0 . "INSERT")
    (cons 2 $bname)
    (assoc 8 $entSelect)
    (cons 10 $inspt)
    (cons 41 1)
    (cons 42 1)
    (cons 43 1)
    (cons 50 (* $rotang (/ pi 180)))
    (assoc 210 $entSelect)
    '(102 . "{ACAD_XDICTIONARY")
    (assoc 360 $entSelect)
    '(102 . "}")
)

(setq $entityName (entmake $entList))

 

all the properties are added correctly, except for the "ACAD_XDICTIONARY"  with assoc 360

 

What are we missing?  any ideas? 

Link to comment
Share on other sites

You want to entmake a Block ? This example makes objects, a block with an attribute.

 

(defun make_circle ()
  (entmake (list (cons 0 "CIRCLE")
	 (cons 8 "0")
	 (cons 10 (list 0 0 0))
	 (cons 40 3.25)		; rad
	 (cons 210 (list 0 0 1))
	 (cons 62 256)
	 (cons 39 0)
	 (cons 6 "BYLAYER")
   )
  )
)					; DEFUN

(defun make_sq ()
  (setq	vertexList
  (list
  (list -3.25 -3.25 0.)
  (list 3.25 -3.25 0.)
  (list 3.25 3.25 0.)
  (list -3.25 3.25 0.)
  ))
  (entmake
    (append 
    (list '(0 . "LWPOLYLINE")
    '(100 . "AcDbEntity")
    '(100 . "AcDbPolyline")
    (cons 90 (length vertexList))
    (cons 70 1)			; 1 closed : 0 open
    (cons 8 "0")
    (cons 38 0.0)
    (cons 210 (list 0.0 0.0 1.0))
    )
    (mapcar '(lambda (pt) (cons 10 pt)) vertexList)
    )
  )
)					; defun

(defun Make_bubble ( )

  (entmake (list (cons 0 "BLOCK")
    (cons 2 Blkname)
    (cons 70 2)
    (cons 10 (list 0 0 0))
    (CONS 8 "0")
  ))

  (if (= resp "Circle")
  (make_circle)
  (make_sq)
  )

  (entmake (list (cons 0 "ATTDEF")
       (cons 8 "0")
       (cons 10 (list 0 0 0))
       (cons 1 "1")		; default value
       (cons 2 blkname)		; nblock name
       (cons 3 "Ptnum")		; tag name
       (cons 6 "BYLAYER")
       (cons 7 "STANDARD")	;text style
       (cons 8 "0")		; layer
       (cons 11 (list 0.0 0.0 0.0)) ; text insert pt
       (cons 39 0)
       (cons 40 3.5)		; text height
       (cons 41 1)		; X scale
       (cons 50 0)		; Text rotation
       (cons 51 0)		; Oblique angle
       (cons 62 256)		; by layer color 
       (cons 70 0)
       (cons 71 0)		;Text gen flag
       (cons 72 1)		; Text Justify hor 1 center
       (cons 73 0)		; field length
       (cons 74 2)		; Text Justify ver 2 center
       (cons 210 (list 0 0 1))
  ))

  (entmake (list (cons 0 "ENDBLK")))
  (princ)
 
)

 

Link to comment
Share on other sites

The question was asked here already :

https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-copy-a-dictionary-from-one-entity-to-a-new-one/td-p/10465008

 

I think the goal OP wants to achieve is not to bind the same extension dictionary to 2 different entities, but to replace one that have this data (points) with another (block) that would be placed at the same location and inherit extension dictionary from sources... But Roy_043, I think you answered on OP's question in the title, thanks...

  • Thanks 1
Link to comment
Share on other sites

Thanks Roy_043 in the loop i deleted the point before entmake the new block an it seems to work. My first code tried to make the block first and after that deleted the point. But that wont work if it's not allowed two entities cannot reference the same extension dictionary.

Link to comment
Share on other sites

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...