Hello, in my project, I am using AIS_ConnectedInteractive class to have multiple instances of the same TopoDS_Shape appropriately translated and scaled. Everything works fine except for the HLR representation. When I request this type of representation, the ComputeHLR method, which performs the final positioning starting from the connected TopoDS_Shape by multiplying the transformation that defines its position with the transformation applied to AIS_ConnectedInteractive, raises an exception when it generates a new translated and scaled TopoDS_Shape using the "Located" method. The exception is as follows: "Standard_DomainError("Location with scaling transformation is forbidden")." Now, after reading some documentation, it seems that scaling a TopoDS_Shape by applying the scaling transformation to its position is not recommended. Is this a bug, or is there a different way to obtain HLR representation for an AIS_ConnectedInteractive? I'd like to add that this exception was not present in version 7.4.0 of OpenCascade (the previous version I've used), but it is present in the latest version, 7.7.0.
The orginal code of AIS_ConnectedInteractive::ComputeHLR, is the sequent:
void AIS_ConnectedInteractive::computeHLR (const Handle(Graphic3d_Camera)& theProjector,
const Handle(TopLoc_Datum3D)& theTransformation,
const Handle(Prs3d_Presentation)& thePresentation)
{
const bool hasTrsf = !theTransformation.IsNull()
&& theTransformation->Form() != gp_Identity;
updateShape (!hasTrsf);
if (myShape.IsNull())
{
return;
}
if (hasTrsf)
{
const TopLoc_Location& aLocation = myShape.Location();
TopoDS_Shape aShape = myShape.Located (TopLoc_Location (theTransformation->Trsf()) * aLocation);
AIS_Shape::computeHlrPresentation (theProjector, thePresentation, aShape, myDrawer);
}
else
{
AIS_Shape::computeHlrPresentation (theProjector, thePresentation, myShape, myDrawer);
}
}
I've derived a class from AIS_ConnectedInteractive and overridden the ComputeHLR method as follows:
void MyAIS_ConnectedInteractive::computeHLR (const Handle(Graphic3d_Camera)& theProjector,
const Handle(TopLoc_Datum3D)& theTransformation,
const Handle(Prs3d_Presentation)& thePresentation)
{
const bool hasTrsf = !theTransformation.IsNull()
&& theTransformation->Form() != gp_Identity;
updateShape (!hasTrsf);
if (myShape.IsNull())
{
return;
}
if (hasTrsf)
{
const TopLoc_Location& aLocation = myShape.Location();
//TopoDS_Shape aShape = myShape.Located (TopLoc_Location (theTransformation->Trsf()) * aLocation);
TopoDS_Shape aShape = myShape.Located(TopLoc_Location(aLocation));
BRepBuilderAPI_Transform transform(theTransformation->Trsf());
transform.Perform(aShape, true, true);
aShape = transform.Shape();
AIS_Shape::computeHlrPresentation (theProjector, thePresentation, aShape, myDrawer);
}
else
{
AIS_Shape::computeHlrPresentation (theProjector, thePresentation, myShape, myDrawer);
}
}
And everything works fine. So I am wondering if this is a bug or if it is due to my incorrect usage of OpenCascade's HLR feature?