Allow Section based on ViewMulti
This commit is contained in:
committed by
Yorik van Havre
parent
8193455890
commit
ce7f6ed351
@@ -116,6 +116,33 @@ void DrawViewMulti::onChanged(const App::Property* prop)
|
||||
DrawViewPart::onChanged(prop);
|
||||
}
|
||||
|
||||
TopoDS_Shape DrawViewMulti::getSourceShape(void) const
|
||||
{
|
||||
TopoDS_Shape result;
|
||||
const std::vector<App::DocumentObject*>& links = Sources.getValues();
|
||||
if (links.empty()) {
|
||||
Base::Console().Log("DVM::execute - No Sources - creation? - %s\n",getNameInDocument());
|
||||
} else {
|
||||
BRep_Builder builder;
|
||||
TopoDS_Compound comp;
|
||||
builder.MakeCompound(comp);
|
||||
for (auto& l:links) {
|
||||
if (!l->isDerivedFrom(Part::Feature::getClassTypeId())){
|
||||
continue; //not a part
|
||||
}
|
||||
const Part::TopoShape &partTopo = static_cast<Part::Feature*>(l)->Shape.getShape();
|
||||
if (partTopo.isNull()) {
|
||||
continue; //has no shape
|
||||
}
|
||||
BRepBuilderAPI_Copy BuilderCopy(partTopo.getShape());
|
||||
TopoDS_Shape shape = BuilderCopy.Shape();
|
||||
builder.Add(comp, shape);
|
||||
}
|
||||
result = comp;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
App::DocumentObjectExecReturn *DrawViewMulti::execute(void)
|
||||
{
|
||||
if (!keepUpdated()) {
|
||||
@@ -128,29 +155,17 @@ App::DocumentObjectExecReturn *DrawViewMulti::execute(void)
|
||||
return DrawViewPart::execute();
|
||||
}
|
||||
|
||||
//Base::Console().Message("TRACE - DVM::execute() - %s/%s\n",getNameInDocument(),Label.getValue());
|
||||
|
||||
BRep_Builder builder;
|
||||
TopoDS_Compound comp;
|
||||
builder.MakeCompound(comp);
|
||||
for (auto& l:links) {
|
||||
if (!l->isDerivedFrom(Part::Feature::getClassTypeId())){
|
||||
continue; //not a part
|
||||
}
|
||||
const Part::TopoShape &partTopo = static_cast<Part::Feature*>(l)->Shape.getShape();
|
||||
if (partTopo.isNull()) {
|
||||
continue; //has no shape
|
||||
}
|
||||
BRepBuilderAPI_Copy BuilderCopy(partTopo.getShape());
|
||||
TopoDS_Shape shape = BuilderCopy.Shape();
|
||||
builder.Add(comp, shape);
|
||||
m_compound = TopoDS::Compound(getSourceShape());
|
||||
if (m_compound.IsNull()) {
|
||||
return new App::DocumentObjectExecReturn("DVP - Linked shape object(s) is invalid");
|
||||
}
|
||||
m_compound = comp;
|
||||
TopoDS_Compound comp = m_compound;
|
||||
|
||||
gp_Pnt inputCenter;
|
||||
try {
|
||||
inputCenter = TechDrawGeometry::findCentroid(comp,
|
||||
Direction.getValue());
|
||||
shapeCentroid = Base::Vector3d(inputCenter.X(),inputCenter.Y(),inputCenter.Z());
|
||||
TopoDS_Shape mirroredShape = TechDrawGeometry::mirrorShape(comp,
|
||||
inputCenter,
|
||||
getScale());
|
||||
|
||||
Reference in New Issue
Block a user