I would expect the following code to display three coordinate arrows
along the coordinate axis. But that's not what happens. Am I doing
something wrong?

def make_coordinate_arrows(event=None):
    #typical origin symbol
    display.DisplayShape(make_vertex(gp_Pnt(0,0,0)))
    x = gp_Trsf(); x.SetTransformation(gp_Ax3(gp_Pnt(0,0,0), gp_Dir(1,0,0)))
    y = gp_Trsf(); y.SetTransformation(gp_Ax3(gp_Pnt(0,0,0), gp_Dir(0,1,0)))
    z = gp_Trsf(); z.SetTransformation(gp_Ax3(gp_Pnt(0,0,0), gp_Dir(0,0,1)))
    display.DisplayColoredShape(make_arrow_to(scale=3, dest=x), 'RED')
    display.DisplayColoredShape(make_arrow_to(scale=3, dest=y), 'GREEN')
    display.DisplayColoredShape(make_arrow_to(scale=3, dest=z), 'BLUE')

def make_arrow_to(dest=gp_Trsf(), scale=1, text=None, color='YELLOW'):
    for i in 0, 1, 2, 3:
        print dest._CSFDB_Getgp_Trsfmatrix().Column(i).Coord()
    if text is not None: make_text(text,
Point(dest.TranslationPart().Coord()), 6)
    return BRepBuilderAPI_Transform(make_arrow_only(scale=scale,
text=text, color=color), dest).Shape()

def make_arrow_only(origin=gp_Ax1(gp_Pnt(0,0,0), gp_Dir(0,0,1)),
scale=1, text=None, color="YELLOW"):
    assert type(origin) == gp_Ax1
    body = BRepPrimAPI_MakeCylinder(0.02*scale, 0.7*scale).Shape()
    head = BRepPrimAPI_MakeCone(0.1*scale,0.001,0.3*scale).Shape()
    head = move_shape(head, gp_Pnt(0,0,0), gp_Pnt(0,0,0.7*scale))
#move cone to top of arrow
    return BRepAlgoAPI_Fuse(head, body).Shape()

screenshot:
http://adl.serveftp.org/lab/opencascade/opencascade_coordinate_axis_arrows.png

Instead, what happens is that it appears that the y-axis coordinate
arrow is rotated 90 degrees about the z-axis, so that it is parallel
to the x-axis coordinate arrow (as you can see in the screenshot). On
the left is the solid shape mode view, and on the right is the
wireframe mode view.

What's going on?

- Bryan
http://heybryan.org/
1 512 203 0507

_______________________________________________
Pythonocc-users mailing list
Pythonocc-users@gna.org
https://mail.gna.org/listinfo/pythonocc-users

Reply via email to