getting a list of points that make up an edge using the draw environment.

Hello,
I have a curved edge that is visible in the draw environment viewer.

Is there any easy way to export a list of points that form the tessellated curve shown in the viewer?

gkv311 n's picture

Well, you may use dump to print entire information about picked TopoDS_Edge and look for PolygonOnTriangulations, Triangulations, but this would require some parsing if you want to do something with this information.

Otherwise, there are commands triepoints, which generates a list of VERTEX out of tessellated EDGE, and pnt command to print coordinates of each VERTEX:

pload MODELING VISUALIZATION
pcone c 100 10 50

# remove existing tessellation if needed
#tclean c
# tessellate shape with specified quality
incmesh c -prs

axo
fit
# pick one edge to dump
explode c E
donly c_1

# dump entire shape - see PolygonOnTriangulations and Triangulations sections
#dump c_1

set pp [triepoints c_1]
foreach p $pp { puts [pnt $p] }

Possible output:

Draw[27]> set pp [triepoints c_1]
c_1_1 c_1_2 c_1_3 c_1_4 c_1_5 c_1_6 c_1_7 c_1_8 c_1_9 c_1_10 c_1_11 c_1_12 c_1_13 c_1_14 c_1_15 c_1_16 c_1_17 c_1_18 c_1_19 c_1_20 c_1_21 c_1_22 c_1_23 c_1_24 c_1_25 c_1_26 c_1_27 c_1_28 c_1_29 c_1_30 c_1_31 c_1_32 c_1_33 c_1_34 c_1_35 c_1_36 c_1_37
Draw[28]> foreach p $pp { puts [pnt $p] }
9.9999999999999858 -2.449293598294703e-15 50
9.8480775301220653 1.7364817766693008 50
9.396926207859071 3.4202014332566821 50
8.6602540378443749 4.999999999999992 50
...
Mike Molinari's picture

Thank you.
That code worked perfectly.

Also are you the same person who ported the draw environment to wasm?

gkv311 n's picture

You may guess.