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

how to get geometry data from DWF file

13 REPLIES 13
Reply
Message 1 of 14
Majd_Zoubi
2636 Views, 13 Replies

how to get geometry data from DWF file

Hello,

I'm trying to make new importer in SimLab Composer reads DWF file so I need object geomety data .

I could not find any examples on how to extract object geometry data. is there any example helps me ? if not , would it possible to get small code shows how to get DWFModel and object geometry data from DWF File .

 

regards

Majd

13 REPLIES 13
Message 2 of 14
geotavros
in reply to: Majd_Zoubi

You need to look at W3D samples. All 3D data is stored inside .w3d file which is inside .dwf file.

Message 3 of 14
Majd_Zoubi
in reply to: geotavros

thanks for your reply,

now i have get geometry data through BStreamFileToolKit parsing, now I'm trying to read node names for each node , the structure in ObjectDefinitionReader example is clear to traversing around nodes and reading names but i can't see how to match between objects and names in BStreamFileToolKit parsing.

 

regards,

Majd

Message 4 of 14
SilviaCao
in reply to: Majd_Zoubi

Thank you for your question.

 

You use the ObjectDefinitionReader to get the node’s name and node’s id; the node id is used to match the geometry object, which is the tag id (TK_Tag).

 

Please let us know if you have any further questions.



Silvia Cao
SW Engineer
PSEB-GE- ACRD PSEB
Autodesk, Inc.
Message 5 of 14
Majd_Zoubi
in reply to: SilviaCao

thank you for your reply

can you show me small code example .

Message 6 of 14
SilviaCao
in reply to: Majd_Zoubi

We don’t have the sample yet; you will need to write the code.

 

Please let us know if you have any question.



Silvia Cao
SW Engineer
PSEB-GE- ACRD PSEB
Autodesk, Inc.
Message 7 of 14
geotavros
in reply to: SilviaCao

Using ReadContentDefinition sample I got all DWFInstance objects. Using DWFInstance::getNodeID() I got ID of each instance. The IDs are: 1, 2, 3, 4 for my sample file. 

When parsing 3D stream using SimpleW3DStreamProcessor sample I get TKE_Tag opcode and handle it using TK_Tag's subclass TkTagHandler. In TkTagHandler::Execute() I increase the counter. 

In my sample file I get like 12 TKE_Tag opcodes. 

 

I want to get the extended attributes of TK_Shell entities. And can't find a way to match the ID obtained from DWFInstance::getNodeID() with TK_Shell entity. You say I need to use the count of TK_Tag entities, but when do I need to start counting them? Do I need to count them from the start of 3D stream parsing or from the TK_Open_Segment?

Message 8 of 14

Silvia is there a way to add more properties using the ObjectDefinition that you commented above?

Emanuel Ceballos
ENGworks - Software Developer
Message 9 of 14
SilviaCao
in reply to: geotavros

Count the TK_Tag; and the current segment (TK_Open_Segment) which contains the TK_Tag will be map to the DWGInstance by the node id and tag id.

 

Thanks,

Silvia



Silvia Cao
SW Engineer
PSEB-GE- ACRD PSEB
Autodesk, Inc.
Message 10 of 14

Yes, we can add more properties to the ObjectDefinition:

  1. Read the DWF and the ObjectDefinition (please refer to the toolkit sample ObjectDefinitionReader);
  2. Add more properties to the ObjectDefinition;
  3. Save the DWF file and the ObjectDefinition.


Silvia Cao
SW Engineer
PSEB-GE- ACRD PSEB
Autodesk, Inc.
Message 11 of 14

Hi Silvia, thanks very much for your answer. I've managed to read the ObjectDefinition, this returns a list of DWFDefinedObjectInstance and I'm adding new properties to these Instances using pInst->addProperty( DWFCORE_ALLOC_OBJECT(DWFProperty(L"my_name", L"my_value", L"my_category")), true );

 

What I can't find is a way to save the modifications to the DWF and the ObjectDefinition. What's the correct way to do this?

 

Thanks.

Emanuel Ceballos
ENGworks - Software Developer
Message 12 of 14

You can save the new object definition resource by DWFObjectDefinitionResource::serializeXML; here is a code snapshot:

DWFPointer<DWFBufferOutputStream> apOutputStream( DWFCORE_ALLOC_OBJECT(DWFBufferOutputStream(_DWFTK_OBJECT_DEFINITION_RESOURCE_INITIAL_BUFFER_BYTES)), false );

DWFUUID oUUID;

DWFPointer<DWFXMLSerializer> apSerializer( DWFCORE_ALLOC_OBJECT(DWFXMLSerializer(oUUID)), false );

apSerializer->attach( apOutputStream );

objectdefinitionresource->serializeXML( apSerializer, DWFPackageWriter::eObjectDefinition );

apSerializer->detach();

The code is to create a new stream of the object definition resource; then you can create a new DWFObjectDefinitionResource and attach the new stream.



Silvia Cao
SW Engineer
PSEB-GE- ACRD PSEB
Autodesk, Inc.
Message 13 of 14

Thank you very much Silvia. I will try it and let you know.

Emanuel Ceballos
ENGworks - Software Developer
Message 14 of 14
anupw
in reply to: SilviaCao

Hello Silvia,

 

I would like to start the discussion on "how to get geometry data from DWF file" again. From the earlier discussion I understand that I have to add a counter during reading the segment and shell. Please let me know whether my understanding is correct.

I did following changes in my implementation of TK_Open_Segment and TK_Shell handler classes.

1. I created one static counter and initialized it with 0 (since the tags are seen to be initialized from 1 and indices been starting with 0). Please let me know whether this is correct.

2. I incremented the counter in Execute() implementation inside OpenSegment and Shell opcode handlers.

 

With these changes i assumed that the counter value in shell handler is the same as that for the node id for the corresponding object (DWFObject).

But I got results that did not match the DWFInstance id with the counter.

 

Please let me know if I am doing anything wrong. I have attached the sample file which is written using the sample program 3DPublish (sample3DPublish.dwf) and the modified SimpleW3DStreamProcessor.cpp which implements the counter mechanism.

 

Thank you,

Anup

Tech Lead

Prototech Solutions

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

Post to forums  

”Boost

 

”Tips

 

”Services