Author Topic: The owner of entities which using entmakex  (Read 808 times)

0 Members and 1 Guest are viewing this topic.

xiaxiang

  • Guest
The owner of entities which using entmakex
« on: March 03, 2016, 04:36:12 AM »
Hi Guys.

It is failed when  the entmakex function was performed in the dbxdocument.
Although it's taken for granted  that No ent* methods is permitted for objectdbx,
but the entities is in fact maked in the activedocument(eg. the drawing which run the lisp codes).

So, please tell me how can I get  the owner of entities when using ObjectDBX entmaking.
Mang thanks.

add 330 dxf code is no use.
Code: [Select]
(cons 330  OwnrObj)

the two owner objects listed as followed are wrong.

Code: [Select]
(vla-get-block (vla-item(vla-get-Layouts Doc) "Model")

Code: [Select]
(vlax-invoke doc
(if (vlax-method-applicable-p doc 'objectidtoobject32)
'ObjectIdToObject32
'ObjectIdToObject
)
(if (vlax-method-applicable-p doc 'objectidtoobject32)
(vla-get-OwnerId32 Obj)
(vla-get-OwnerId Obj)
)
)

Lee Mac

  • Seagull
  • Posts: 12514
  • London, England
Re: The owner of entities which using entmakex
« Reply #1 on: March 03, 2016, 08:57:16 AM »
Use an appropriate vla-add* function with the Block argument derived from the ObjectDBX Document to create your objects as opposed to using entmake(x) - see Example 1 from here for an example of how to accomplish this.

xiaxiang

  • Guest
Re: The owner of entities which using entmakex
« Reply #2 on: March 03, 2016, 08:27:08 PM »
Use an appropriate vla-add* function with the Block argument derived from the ObjectDBX Document to create your objects as opposed to using entmake(x) - see Example 1 from here for an example of how to accomplish this.

Hi Lee
Thanks for sparing time to reply.

I just want to assign an owner when making a new object or entity using entmakex.
I know that Using an appropriate vla-add* function can do the job but,using entmakex can obtain speed
more then vla-add*

the follow code is used in your Burstupgrade.lsp
Code: [Select]
(defun LM:burst:att2text ( enx )
    (entmakex
        (append '((0 . "TEXT"))
            (LM:burst:removepairs '(000 002 070 074 100 280)
                (subst (cons 73 (cdr (assoc 74 enx))) (assoc 74 enx) enx)
            )
        )
    )
)

(defun LM:burst:matt2mtext ( enx )
    (entmakex
        (append '((0 . "MTEXT") (100 . "AcDbEntity") (100 . "AcDbMText"))
            (LM:burst:remove1stpairs  '(001 007 010 011 040 041 050 071 072 073 210)
                (LM:burst:removepairs '(000 002 042 043 051 070 074 100 101 102 280 330 360) enx)
            )
        )
    )
)

As you said,I got the Block argument (OwnrObj) derived from the ObjectDBX Document to create the owner objects,
then
Code: [Select]
(entmakex
      (append (list '(0 . "TEXT") (cons 330 OwnrObj))
          (LM:burst:removepairs '(000 002 070 074 100 280)
              (subst (cons 73 (cdr (assoc 74 enx))) (assoc 74 enx) enx)
          )
      )
 )

but the entities is in fact maked in the activedocument(etc. the drawing which run the lisp codes).
refer to the help topic
Code: [Select]
Examples
_$ (entmakex '((0 . "CIRCLE") (62 . 1) (10 4.0 3.0 0.0) (40 . 1.0)))
<Entity name: 1d45558>
Warning:
Objects and entities without owners are not written out to DWG or DXF files.
Be sure to set an owner at some point after using entmakex .
For example, you can use dictadd to set a dictionary to own an object.
So the questions are ,
how to handle this owners?
how to understand DXF code 330(soft pointer)and 360(hard pointer)?
If need to handle dictionary ,is there any example?
« Last Edit: March 03, 2016, 08:35:27 PM by xiaxiang »