Hmm, you mean the path to the 3rd-party in the system is not spelled out?
I installed this distribution https://dev.opencascade.org/release/previous#node-84228
opencascade-7.7.0-vc14-64.exe
Can you tell me what exactly should be in the environment variables?
As for my code - unfortunately it's quite large and I can't pick out some pieces to show how I build everything...
It goes something like this:
STEPControl_Reader reader;
stat = reader.ReadFile(filepath);
reader.TransferRoots();
TopoDS_Shape shape = reader.OneShape();
Handle(XSControl_WorkSession) WS = reader.WS();
Handle(Interface_InterfaceModel) Model = WS->Model();
. . . .
bool SOP_IVS_Step_data::getShapeRep(const STEPControl_Reader &reader)
{
for (Standard_Integer i = 1; i <= Model->NbEntities(); i++)
{
Handle(Standard_Transient) Entity = Model->Value(i);
// If SHAPE_REPRESENTATION
if (Entity->DynamicType() == STANDARD_TYPE(StepShape_ShapeRepresentation))
{
Handle(StepShape_ShapeRepresentation) shapeRep = Handle(StepShape_ShapeRepresentation)::DownCast(Entity);
// Set flag
int flag = setFlagForShapeRep(Model, i);
getShapeRepsInfo(Model, shapeRep, flag); // Gather the necessary information (id, name, transformation_items, context, etc.)
// Only for geometry entities
if (flag == 2)
{
getAdvancedBrep(Model, shapeRep); // Find the geometry for a particular SHAPE_REPRESENTATION if it is a “leaf” in the hierarchy
}
}
}
}
int SOP_IVS_Step_data::setFlagForShapeRep(Handle(Interface_InterfaceModel)& Model, const int& shapeRepId)
{
int a = 0, b = 0;
for (Standard_Integer i = 1; i <= Model->NbEntities(); i++)
{
Handle(Standard_Transient) Entity = Model->Value(i);
// If REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION
if (Entity->IsKind(STANDARD_TYPE(StepRepr_RepresentationRelationshipWithTransformation)))
{
Handle(StepRepr_RepresentationRelationshipWithTransformation) relWithTransformation =
Handle(StepRepr_RepresentationRelationshipWithTransformation)::DownCast(Entity);
if (!relWithTransformation.IsNull())
{
// Get relationship
Handle(StepRepr_Representation) rep1 = relWithTransformation->Rep1();
Handle(StepRepr_Representation) rep2 = relWithTransformation->Rep2();
// Check relationship SHAPE_REPRESENTATION with entity
if (Model->Number(rep1) == shapeRepId) a++;
if (Model->Number(rep2) == shapeRepId) b++;
}
}
}
// Set type flag
if (a > 0 && b == 0) return 0; // root
if (a > 0 && b > 0) return 1; // sub root
return 2; // geometry
}
And so on.
By extracting the entities I need, analyzing their items or context or id, I look for matches, and finally collect the information in
std::map<int, ShapeRepsData>
And then, from this date, I take the collected information on all the “leaves” in the hierarchy tree and build the geometry in Houdini.
I agree - everything is not optimal, to put it mildly (