Thu, 05/07/2020 - 01:07
I would like to get wireframe representation with WriteVrml on the Doc level similar to writevrml on the shape level. draw help mentions an option for that but I am not sure if it is actually implemented. Is it supposed to work ?
I think incmesh necessarily tesselates all edges as well but perhaps there is something else which needs to be prepared ?
Draw[15]> pwd
C:/OpenCASCADE-7.4.0-vc14-64/opencascade-7.4.0/data/step
Draw[16]> ReadStep D screw.step
File STEP to read : screw.step
Document saved with name D
Draw[17]> XGetFreeShapes D shape
shape
Draw[18]> incmesh shape 1
Incremental Mesh, multi-threading OFF
Meshing statuses: NoError
Draw[19]> help WriteVrml
WriteVrml : Doc filename [version VRML#1.0/VRML#2.0 (1/2): 2 by default] [representation shaded/wireframe/both (0/1/2): 0 by default]
Draw[20]> WriteVrml D screwWire.wrl 2 1
This does not include the wireframe lines in the output. In fact, it still includes the shaded surfaces.
For the screw example, one can just use writevrml:
Draw[27]> help writevrml
writevrml : shape file [version VRML#1.0/VRML#2.0 (1/2): 2 by default] [representation shaded/wireframe/both (0/1/2): 1 by default]
Draw[28]> writevrml shape screwShapeWire.wrl 2 1
since there is just one simple shape. But for more complex assemblies it would be necessary to find and iterate over all subshapes and referred shapes. If WriteVrml does not apply how to best go through the document to extract all necessary shapes for writevrml ?
(This is just asking in terms of draw since it is convenient)
Thu, 05/07/2020 - 20:55
Hi Andreas,
you could try to use XGetOneShape to get a shape containing the free shapes.
https://www.opencascade.com/doc/occt-7.4.0/overview/html/occt_user_guide...
Greets,
Patrik
Fri, 05/08/2020 - 19:17
Apologies for the delayed response, and many thanks for the suggestion.
I tried XGetOneShape with as1-oc-214.stp:
This generates an incomplete wireframe, eg. only for the immediate/non-referenced subshapes (see attached image). More accurately, it appears that only the first of the references to a given subshape is included. The second and all subsequent references are apparently ignored. Or perhaps no instances are included, only solid parts.
How do I best find and cycle through all, including the referred subshapes (all nuts in the example) ?
Fri, 05/08/2020 - 19:15
Here is the structure of as1-oc-214.stp:
And attached the complete wireframe for comparison.
Thu, 05/14/2020 - 11:41
Hi Andreas,
you could check the XDump source. If you use XDE. it could be easier to generate your own VRML output as you can usie instancing inside VRML to reduce the file size.
But this depends on your use case.
Greets,
Patrik
Thu, 05/14/2020 - 22:23
Yes, this is essentially what I am doing, using pythonocc as a starting point. I believe occ WriteVrml actually does DEF/USE for instancing just not for the wireframe.