How to make a TopoDS_Compound which contain different line type or color

Hi body,
I have several lines and their line type(solid or dashed) and color(yellow) are different. I want to group them into one object, so I make a TopoDS_Compound with these lines, but these line type become solid and color become red.

Who can tell me how to group these lines and these lines still have orginal attribute.

Sharjith Naramparambath's picture

Hi,
You can do this by defining the compute method in such a way that every edge in your TopoDS_Compound has its WireAspect set at different line styles and colors according to your need. But warn you , this is computational intensive when you have a lot of edges.

Best Luck!
N Sharjith

angel's picture

Hi,
Thanks your reply,my final aim is that I want to group the objects which have different line styles and colors in the 3D view into one object, and I can just only pick one object to move, because I do'nt want to mulit select these objecets in 3D view to translate.

If I want to do that, beside the way which deal with "TopoDS_Compound", do you have any ideaa?

Now, I have some concept but I don't know how to do. I think we can see the line color and types in the 3D view because we give the property into AIS_InteractiveObject, so maybe there is a mechanism which that can group the objects into one and doesn't lose WireAspect in the 3D view.

Sincerely,
Angel

Sharjith Naramparambath's picture

Hi,
I dont know any better way other than using the TopoDS_compound but you can make your own AIS_Interactive object without using TopoDS_Compound, but then u have to call very low level cascade objects. I haven't tried lower level. But for large number of lines TopoDS_Compound is surely slow. I faced a similar problem when I was making an application for simulating tool movement by reading G Code for NC machines. I wanted to show the rapid moves by dashed lines and feed moves by solid lines. I derived a class from the AIS_InteractiveObject with TopoDS_Compound as member and computed the presentation of individual edges with different wire aspects - it worked but when I loaded large G Code files, it was toooo slow. The same thing I had done earlier without cascade, just using pure OpenGL code and it is very fast.

Best Luck!
N Sharjith.