ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

What's a hard-pointer reference?

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
VB_Autocad_guy
1610 Views, 6 Replies

What's a hard-pointer reference?

Hi, 

 

I'm doing mostly .NET programming. 

But I came across this and I wanted to learn more about this. 

 

What's a hard-pointer reference? 

 

I'm trying to understand why I have two identical blocks, one purges (when I use the PURGE command from Autocad)

and the other doesn't. What distingushes a block from being purged and one not being. I'm assuming it has something to do with a hard-pointer reference? What objects do you use to associate hard-pointer references? 

 

Here's my references and what I'm understanding thus far. 

 

Database.Purge() is a bit of a misnomer, in my opinion.  That function doesn't purge items, it just tells you whether or not they are safe to erase -- you do have to erase them yourself.  You can erase them without using Database.Purge(), but you can easily corrupt your drawing that way. (http://forums.autodesk.com/t5/NET/Purge-Linetypes/m-p/2899312/highlight/true#M22478)

 

Database.Purge Method (ObjectIdCollection)

Description
 

This function searches through the database to see if there are any hard references to objects with object ID entities in the ids array. If any such objects are found, their object ID entities are removed from the ids array. So, when this function returns, the ids array will contain only object ID entities of objects that are not currently hard-referenced and thus can safely be erased. 

If the database is in a partially opened state, object ID entities of objects that were not created in the current editing session are also removed from the ids array.

Note
This function does not modify the database in any way. 

 

To duplicate the AutoCAD purge mechanism functionality, use this function to determine what database objects (of the type desired) can be purged or erased, and then open each such object, call its erase() method to erase it, and close it. For example, to purge all unreferenced layers, call the purge method, passing in an array containing the object ID entities of all the LayerTableRecords in the LayerTable, then erase all the objects whose object ID entities are still in the array after the purge function has returned.

 


6 REPLIES 6
Message 2 of 7
adam.nagy
in reply to: VB_Autocad_guy

HI there,

 

A hard pointer or hard reference is a reference that is pointing at an object that is vital for the other one. E.g. if a line is on "Layer 2" then the line has a hard pointer to "Layer 2", because it could not exist without it.

The line will also have a hard pointer to a linetype table record.

 

You can use a tool like ArxDbg (part of the ARX SDK samples) to check what sort of references and ownerships objects have inside the database. ArxDbg's .NET equivalent (MgdDbg) might have that feature too: the .DLL and its accompanying source project for AutoCAD 2010

 

I hope this helps.

 

Adam Nagy

Autodesk Developer Network



Adam Nagy
Autodesk Platform Services
Message 3 of 7

Thank you. So it's like a dependency or tells acad that object A relies on object/layer B.

Hmmm .... I'll use arxdbg and mdgmdb to explore more. I've used those tools before. I'll keep exploring. Thanks for the response Adam.
Message 4 of 7

On the topic of purging, my experience with RealDWG showed that a second iteration of calling purge and attempting to erase the resulting objects, removed additional objects. While I don't tknow the exact reason why that is the case, it seems plausible, and for some cases was effective, so you may wish to try a second purge.

 

Message 5 of 7
BKSpurgeon
in reply to: adam.nagy

Thanks Adam

 

What is the difference between a hard pointer reference and a soft pointer reference?

 

I came across both in the ObjectArx documentation.

 

clarification much appreciated.

 

rgds

 

Ben

Message 6 of 7
moogalm
in reply to: BKSpurgeon

Your custom object / entities have Pointer references to other objects in Database. Basically all DB objects can be pointed or point to any number of objects.

Hard Pointer Reference:

A hard pointer reference protects an object from purge.
For example, an entity contains a hard pointer reference to a layer. Therefore, you can't purge a layer that is pointed to by one or more entities.
Or A text entity contains a hard pointer reference to a text style.

Soft Pointer Reference:
A soft pointer is simply a pointer to an object. It does not protect the referenced object from purge.
Ex: Xdata references are soft pointers.

Note: If you use a soft pointer to refer to an object, you should check that the object still exists before you open it, because upon purge this can be erased.

Message 7 of 7
tbrammer
in reply to: VB_Autocad_guy

I recomment reading Cloning and Ownership from the ObjectARX: Developer's Guide->Advanced Topics->Deep Cloning->Deep Cloning Basics->Key Concepts of Cloning->Cloning and Ownership. It explains how the different cloning operations deal with hard/soft owners/pointers. See also Object References for an example.


Thomas Brammer ● Software Developer ● imos AGLinkedIn
If an answer solves your problem please [ACCEPT SOLUTION]. Otherwise explain why not.

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

Post to forums  

Autodesk Design & Make Report

”Boost