For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

WriteVrml works only after XDisplay

Andreas Plesch's picture
Forums: 

I am trying to export VRML with Draw using WriteVrml. It works but only after I use XDisplay to render the document on the view. Without, the VRML is generated but only has a header and no geometry content:

Draw[25]> pwd
C:/OpenCASCADE-7.4.0-vc14-64/opencascade-7.4.0/data/step
Draw[28]> ReadStep D screw.step
 File STEP to read : screw.step
Document saved with name D
Draw[31]> WriteVrml D screw.wrl

screw.wrl:

#VRML V2.0 utf8

WorldInfo {
  info [
    "Generated by Open CASCADE Technology 7.4"
  ]
}

After rendering with XDisplay it works:

Draw[26]> vclear
Draw[27]> vinit View1
Driver1/Viewer1/View1
Draw[28]> ReadStep D screw.step
 File STEP to read : screw.step
Document saved with name D
Draw[29]> XDisplay -dispMode 1 D
D:the product name
Draw[31]> WriteVrml D screw.wrl

How can I avoid the rendering ?

Andreas Plesch's picture

Let me know if I can provide anything else to help. WriteStep and WriteIges works as expected, eg. without displaying.

Patrik Mueller's picture

Hi Andreas,

never worked with Draw, but could you try to do

incmesh

after reading and before writing?

I assume

WriteVrml

need tesselation on the shape before writing. If you do a display this is done by AIS.

Best regards,

Patrik

Andreas Plesch's picture

Thank you much. Indeed, generating a mesh worked:

Draw[1]> pload ALL
1
Draw[2]> cd data/step
Draw[3]> ReadStep A screw.step
 File STEP to read : screw.step
Document saved with name A
Draw[4]> XGetFreeShapes A shapes
shapes
Draw[5]> incmesh shapes 0.01 -relative
Incremental Mesh, multi-threading OFF
Meshing statuses: NoError
Draw[7]> WriteVrml A screwMeshed.vrml

The incmesh command is not documented in https://www.opencascade.com/doc/occt-7.4.0/overview/html/occt_user_guides__test_harness.html

I only used draw to reproduce a problem with python. I see that incmesh is the tcl command interface to https://www.opencascade.com/doc/occt-7.4.0/refman/html/class_b_rep_mesh___incremental_mesh.html

Are there examples or recommendations on how to use that class ? How does AIS determine good deflection values ?

Draw[12]> incmesh
Builds triangular mesh for the shape
usage: incmesh Shape LinearDeflection [options]
options:
        -a val          angular deflection for edges in deg
                        (default ~28.64 deg = 0.5 rad)

        -ai val         angular deflection inside of faces in deg
                        (default ~57.29 deg = 1 rad)

        -di val         Linear deflection used to tessellate the face interior.
        -min            minimum size parameter limiting size of triangle's
                        edges to prevent sinking into amplification in case
                        of distorted curves and surfaces

        -relative       notifies that relative deflection is used
                        (switched off by default)

        -int_vert_off   disables insertion of internal vertices into mesh
                        (enabled by default)
        -surf_def_off   disables control of deflection of mesh from real
                        surface (enabled by default)
        -parallel       enables parallel execution (switched off by default)
        -adjust_min     enables local adjustment of min size depending on edge size (switched off by default)

Andreas Plesch's picture

Thanks that worked !

Draw[1]> pload ALL
1
Draw[2]> cd data/step
Draw[3]> ReadStep A screw.step
 File STEP to read : screw.step
Document saved with name A
Draw[4]> XGetFreeShapes A shapes
shapes
Draw[5]> incmesh shapes 0.01 -relative
Incremental Mesh, multi-threading OFF
Meshing statuses: NoError
Draw[7]> WriteVrml A screwMeshed.vrml
Draw[8]> help incmesh
incmesh         : Builds triangular mesh for the shape, run w/o args for help

I am using draw to reproduce an issue I had with python. incmesh uses

https://www.opencascade.com/doc/occt-7.4.0/refman/html/class_b_rep_mesh___incremental_mesh.html#details

Do you of examples or recommendation on how to use BRepMesh_IncrementalMesh ?

Especially with regards to automating deviation parameter selection ? How does AIS choose those for presentation triangulation ?

Draw[12]> incmesh
Builds triangular mesh for the shape
usage: incmesh Shape LinearDeflection [options]
options:
        -a val          angular deflection for edges in deg
                        (default ~28.64 deg = 0.5 rad)

        -ai val         angular deflection inside of faces in deg
                        (default ~57.29 deg = 1 rad)

        -di val         Linear deflection used to tessellate the face interior.
        -min            minimum size parameter limiting size of triangle's
                        edges to prevent sinking into amplification in case
                        of distorted curves and surfaces

        -relative       notifies that relative deflection is used
                        (switched off by default)

        -int_vert_off   disables insertion of internal vertices into mesh
                        (enabled by default)
        -surf_def_off   disables control of deflection of mesh from real
                        surface (enabled by default)
        -parallel       enables parallel execution (switched off by default)
        -adjust_min     enables local adjustment of min size depending on edge size (switched off by default)

Thanks for any feedback or input.

Patrik Mueller's picture

You should ask the OCCT people about the calculation/definition of the default parameters.

Andreas Plesch's picture

Well, I started to dig through the source but I could not find anything special, just default values, and I think relative to bounding box size.

Contact us

Attention: DO NOT use this form for all kind of request for the removal of your personal data. Please follow this link for such cases.