Author Topic: DXF Code - Hard and Soft and how to access them  (Read 7495 times)

0 Members and 1 Guest are viewing this topic.

cadman6735

  • Guest
DXF Code - Hard and Soft and how to access them
« on: April 12, 2011, 02:19:43 PM »
What is the difference between hard and soft DXF code?

Quote
350-359 Soft-owner handle. Arbitrary soft ownership links to other objects within same DXF file or drawing. Translated during INSERT and XREF operations.

360-369 Hard-owner handle. Arbitrary hard ownership links to other objects within same DXF file or drawing. Translated during INSERT and XREF operations.



How do I access to see what is inside these group codes?  I am of the impression that Xref clip boundry is located inside the DXF group code 360, 3 deep.
but how do I just look at the table to see what is in the table itself?

Thanks

Lee Mac

  • Seagull
  • Posts: 12922
  • London, England
Re: DXF Code - Hard and Soft and how to access them
« Reply #1 on: April 12, 2011, 02:29:42 PM »
How do I access to see what is inside these group codes? 

Hi CADMan,

I'll be honest, I can't tell you the difference between a hard/soft owner handle, that answer will hopefully come from a more experienced programmer.

But, in regard to how to access these, you can access them in the same way you would with most other DXF codes:

Code: [Select]
(cdr (assoc <code> <DXF Data>))
Usually such fields contain entity names which can again be queried with entget.

An example, using the DXF 330 code to access the Owner entity for an object:

Code: [Select]
(entget
  (cdr
    (assoc 330
      (entget
        (car
          (entsel)
        )
      )
    )
  )
)

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: DXF Code - Hard and Soft and how to access them
« Reply #2 on: April 12, 2011, 03:14:59 PM »
Check the Advanced DXF documentation under "Persistent inter-object Reference Handles", it indicates the difference between hard and soft references.  Off the top of my head, a hard reference to something (such as a layer) will prevent it from being purged while a soft reference will not.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

cadman6735

  • Guest
Re: DXF Code - Hard and Soft and how to access them
« Reply #3 on: April 12, 2011, 04:55:33 PM »
Hi LeeMac

Quote
in regard to how to access these, you can access them in the same way you would with most other DXF codes:
That's great, so simple.  I didn't realize I could do this, I was expecting some sort of table search or dictionary search, something crazy anyway.  I am not that experianced with DXF codes except for grabbing points, names, handles and such.  Thanks


Hi dgorsman,

Thanks, I will head that way and see what other cool stuff I can learn, thanks for the direction.

Jeff H

  • Needs a day job
  • Posts: 6150
Re: DXF Code - Hard and Soft and how to access them
« Reply #4 on: April 12, 2011, 05:01:00 PM »
Quote
Owners can be either hard or soft owners of their objects.

Hard Ownership
The following are three examples of hard ownership:

-A database object is a hard owner of its extension dictionary.
-The block table is a hard owner of the model space and paper space block table records (but not the other block table records).
-Extension dictionaries are hard owners of their elements.

Soft Ownership

A soft ownership ID (of type AcDbSoftOwnershipId) does not protect the owned object from purge. The following are examples of soft ownership:

In most cases, symbol tables are soft owners of their elements (exceptions include the block *MODEL_SPACE, *PAPER_SPACE, *PAPER_SPACE0, and layer 0; for these elements, the symbol table maintains a hard reference).
Dictionaries are soft owners of their entries (but you can flag a dictionary to be a hard owner of its entries).



Quote
An object reference can be either hard or soft, and it can be either an ownership reference or a pointer reference. The hard or soft distinction indicates whether the referenced object is essential to the existence of the object that refers to it. A hard reference indicates that an object depends on the referenced object for its survival. A soft reference indicates that an object has some kind of relationship to the referenced object, but it is not an essential one.

An ownership reference dictates how objects are filed. If one object owns another, then whenever the first object is filed out, it takes the owned object with it. Because an object can have only one owner, ownership references are used for nonredundant writing out of the database. In contrast, pointer references are used to express any arbitrary reference between AcDb objects. Pointer references are used for complete (redundant) writing out of the database.



cadman6735

  • Guest
Re: DXF Code - Hard and Soft and how to access them
« Reply #5 on: April 12, 2011, 05:03:01 PM »
So basicly if I see any

<Entity name>:  ##?####>

This means I can dig down into it?  More goodies to be found?

Lee Mac

  • Seagull
  • Posts: 12922
  • London, England
Re: DXF Code - Hard and Soft and how to access them
« Reply #6 on: April 12, 2011, 05:06:07 PM »
So basicly if I see any

<Entity name>:  ##?####>

This means I can dig down into it?  More goodies to be found?

Exactly. This may help with the digging  :-)

cadman6735

  • Guest
Re: DXF Code - Hard and Soft and how to access them
« Reply #7 on: April 12, 2011, 05:20:29 PM »
Lee
I have a similar tool but yours is way more involved.

This one is mine (  now I feel inadequate   :-(    )         :-)
Thanks Jeff for your post, makes sense...

Code: [Select]
(defun c:Ent ( / ent) ;entity


  (setq ent (entget(car(entsel))))



  (textpage)

  (terpri)

  (mapcar 'print ent)

(princ)

)


(defun c:nest ( / nest) ;nested


  (setq nent (entget(car(nentsel))))



  (textpage)

  (terpri)

  (mapcar 'print nent)

(princ)

)



(defun c:EntLast ( / )

  (setq
    myEnt (entlast))
  
  (print
  (entget myEnt))



(princ)
)

Lee Mac

  • Seagull
  • Posts: 12922
  • London, England
Re: DXF Code - Hard and Soft and how to access them
« Reply #8 on: April 12, 2011, 05:21:54 PM »
We all start somewhere, I used to have a few functions like those too  :-)

cadman6735

  • Guest
Re: DXF Code - Hard and Soft and how to access them
« Reply #9 on: April 12, 2011, 05:59:30 PM »
Wow,
Lee, I feel a bit silly for even thinking I had a similar tool.  I just figured out what your tool does and it has given me an idea of my own.  I am going to try to build this tool and post it here for you (if you like) or anyone to nit pic for me.  This should be a good project for me to learn about DXF code.

Now, I just need to go and find and different forum to post my questions in till I get this project done.   :roll:

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: DXF Code - Hard and Soft and how to access them
« Reply #10 on: April 12, 2011, 08:35:52 PM »
< .. >

Now, I just need to go and find a different forum to post my questions in till I get this project done.   :roll:

Why would you want to do that ?
The problem solving here is just as efficacious as elsewhere.
 :-)
« Last Edit: April 12, 2011, 09:30:07 PM by Kerry »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

cadman6735

  • Guest
Re: DXF Code - Hard and Soft and how to access them
« Reply #11 on: April 13, 2011, 08:36:32 AM »
Kerry
Sorry, it was my poor attempt at a joke...   :oops:
Meaning that for me to write the tool I have in mind, I would have to go to another forum and ask my questions in order for me to come back and pass it off as my own (which I would not do).
I am so sorry, it is hard to put humor into text when it is only understood in the mind of the one writing it.  I was only trying to be funny and have a little fun, I did not mean to offend anyone.

That being said, here is the start of my idea, it's messy and very simplistic, right now.  (In my head it is more grand)
Code: [Select]
(defun c:DigDeep ()

  (setq
    ent (entget (car (entsel "\nSelect Entity")))
    entName "ENTITY NAME"
  )

  (textpage)
  (mapcar 'print ent)

  (setq code (getint "\nEnter Association Code   "))

  (setq code (entget (cdr (assoc code ent))))

  (textpage)
  (mapcar 'print code)

  (princ)
)

My idea is to list only the Entity Name assoc. code, enter the desired entity code and get the next list of Entity Name assoc. codes
With an option to back out one level or two levels or three levels..., depending on how deep you already are and choose a different Entity Name assoc. code to go
a different direction.  Sort of an exploring tool to find stuff.

Right now I am trying to figure out how to only list the Entity Name assoc. codes.

Lee Mac

  • Seagull
  • Posts: 12922
  • London, England
Re: DXF Code - Hard and Soft and how to access them
« Reply #12 on: April 13, 2011, 08:40:11 AM »
Right now I am trying to figure out how to only list the Entity Name assoc. codes.

Look into the 'type' function  :-)

Lee Mac

  • Seagull
  • Posts: 12922
  • London, England
Re: DXF Code - Hard and Soft and how to access them
« Reply #13 on: April 13, 2011, 09:07:34 AM »
Also, have you explored the 'Inspect' tool (Ctrl+Shift+I) provided with the VLIDE? You can use it to inspect the values of variable in the current session, and drill down (by double-clicking) to inspect the components of each variable.

On a similar note, you can inspect the Drawing Database itself in a similar manner, by going to: View > Browse Drawing Database. From there you can inspect the graphical and non-graphical entities that make up a drawing.


cadman6735

  • Guest
Re: DXF Code - Hard and Soft and how to access them
« Reply #14 on: April 13, 2011, 09:56:01 AM »
I have seen the inspect tool and clicked on it once or twice but I have never used it (I just need to learn how to use it to my advantage).  The Browse is cool.

I am starting to see where you are taking me.  Between the link to your program and now the hint to use the type function.

I am starting to connect the dots.

Thanks

Lee Mac

  • Seagull
  • Posts: 12922
  • London, England
Re: DXF Code - Hard and Soft and how to access them
« Reply #15 on: April 13, 2011, 09:57:44 AM »
I am starting to connect the dots.

Excellent  8-)

Jeff H

  • Needs a day job
  • Posts: 6150
Re: DXF Code - Hard and Soft and how to access them
« Reply #16 on: April 13, 2011, 01:01:22 PM »
I thought you Lisp guys would use ArxDBG


cadman6735

  • Guest
Re: DXF Code - Hard and Soft and how to access them
« Reply #17 on: April 13, 2011, 05:51:53 PM »
what a great tool, thanks for sharing Jeff


cadman6735

  • Guest
Re: DXF Code - Hard and Soft and how to access them
« Reply #18 on: April 13, 2011, 06:58:57 PM »
Jeff

I just watched a video on DefLabs and they where showing a demo of ArxDbg and another tool called MgdDbg...

I was able to find and appload ArxDbg but I can't seem to find MgdDbg, would you know how I could get my hands on it?

Thanks


cadman6735

  • Guest
Re: DXF Code - Hard and Soft and how to access them
« Reply #20 on: April 13, 2011, 08:11:28 PM »
Ok,
I won't tell you that this is where I watched the video and that this is where I found the ArxDbg download but I didn't see the link for the MgdDbg...  Nope, I dont' think I will tell you this... :ugly:

Thanks Jeff

I can't believe I missed it.