I am still struggling with OpenCascade. Today I have got a question regarding the regeneration of a Dimension.
Imagine the following:
I have got a TopoDS Shape and a related AIS_Shape.
Then I generate an AIS_LengthDimension from one face to another one. Everything is displayed correctly. So far so good ...
Now I apply a translation to the TopoDS_Shape and I call AIS_Shape.Set(TopoDS_Shape) and AIS_Shape->Redisplay(). The shape is now displayed at its new position.
But how do I reposition the Dimension ?
I had a look at the sources and everything I see is, that the Compute methods do the computation, but the documentation says, that the user shall not call this methods directly. How can I do this ?
Author
Discussion
7 archived replies
Posts are displayed in their archived order.
01Author
I think I found the problem - but this does not help at all:
The problem is, that the referenced faces returned by AIS_LengthDimension.FirstShape() and AIS_LengthDimension.SecondShape() do not share the same location as the original faces in the TopoDS_Shape - in fact I do not know if they share the faces at all (the documentation says, that copying a TopoDS_Shape does not duplicate its shape data but generates a new location).
The question os now: How can I share the Location of two shapes ?
Has anybody played around with dimensions and has applied transformation to the underlying shapes ?
Kind regards
Author
02Commenter-1
Hello,
I think you will have to do a SetFirstShape and a SetSecondShape on your dimension with the translated shape.
03Author
Thats true, but how to I get the translated shape ? As I said in my response to this topic: The stored shape does not reference to performed translation but shares only the underlying shape.
Author
04Commenter-1
Use the shape you transform and assign to your AIS_Shape.
05Author
Thats excactly what I do - but this does not change the position of my AIS_LengthDimension since this references two faces with the original location !
Author
06Commenter-1
Maybe were are not talking about the same thing?
I'm talking of something like this:
So the shapes in the AIS_Shape and in the AIS_LengthDimension have to be the same...
07Author
Ok, I have checked your code and it works. Thanks for that.
Unfortunately it doesn't help a lot, since a get the two shapes from the AIS_InterActiveContext::SelectedShape() which returns a TopoDS_Shape and not a TopoDS_Shape &
, so I haven't got the original shapes ! Additionally the shapes are loaded from an Iges file, so I haven't got them in memory directly (as in the example above).
So the basic question is: How can I get a reference to the original shapes from an interactive selection ?