Delete check for top-level shape during writing invisibility property.
Added QA command OCC23951.
Fix crash in QA command OCC23951: initialize document, initialize shape.
Added test case bugs/xde/bug23951
Modified QABugs/QABugs_19.cxx to avoid warnings
}
};
+#include <XCAFDoc_ColorTool.hxx>
+#include <STEPControl_StepModelType.hxx>
+#include <STEPCAFControl_Writer.hxx>
+static Standard_Integer OCC23951 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
+{
+ if (argc != 1) {
+ di << "Usage: " << argv[0] << " invalid number of arguments" << "\n";
+ return 1;
+ }
+ Handle(TDocStd_Document) aDoc = new TDocStd_Document("dummy");;
+ TopoDS_Shape s1 = BRepPrimAPI_MakeBox(1,1,1).Shape();
+ TDF_Label lab1 = XCAFDoc_DocumentTool::ShapeTool (aDoc->Main ())->NewShape();
+ XCAFDoc_DocumentTool::ShapeTool (aDoc->Main ())->SetShape(lab1, s1);
+ TDataStd_Name::Set(lab1, "Box1");
+
+ Quantity_Color yellow(1,1,0, Quantity_TOC_RGB);
+ XCAFDoc_DocumentTool::ColorTool (aDoc->Main())->SetColor(lab1, yellow, XCAFDoc_ColorGen);
+ XCAFDoc_DocumentTool::ColorTool(aDoc->Main())->SetVisibility(lab1, 0);
+
+ STEPControl_StepModelType mode = STEPControl_AsIs;
+ STEPCAFControl_Writer writer;
+ if ( ! writer.Transfer (aDoc, mode ) )
+ {
+ di << "The document cannot be translated or gives no result" << "\n";
+ return 1;
+ }
+
+ writer.Write("test_box.step");
+ return 0;
+}
+
+
//=======================================================================
//function : OCC24622
//purpose : The command tests sourcing Image_PixMap to AIS_TexturedShape
theCommands.Add ("OCC24565", "OCC24565 FileNameIGS FileNameSTOR", __FILE__, OCC24565, group);
theCommands.Add ("OCC24755", "OCC24755", __FILE__, OCC24755, group);
theCommands.Add ("OCC24834", "OCC24834", __FILE__, OCC24834, group);
+ theCommands.Add ("OCC23951", "OCC23951", __FILE__, OCC23951, group);
theCommands.Add ("OCC24931", "OCC24931", __FILE__, OCC24931, group);
return;
}
TDF_Label lab = seq.Value(j);
XCAFPrs_Style style;
Quantity_Color C;
- if ( isComponent && lab == L ) {
+ if ( lab == L ) {
// check for invisible status of object on label
if ( !CTool->IsVisible( lab ) ) {
isVisible = Standard_False;
newItems->SetValue( el++, Handle(StepRepr_RepresentationItem)::DownCast(Styles.Style(si)));
// WP->Model()->AddWithRefs ( Handle(StepRepr_RepresentationItem)::DownCast (Styles.Style(si)));
}
- if ( !isVisible ) {
- // create invisibility item and refer for stiledItem
- Handle(StepVisual_Invisibility) Invsblt = new StepVisual_Invisibility();
- Handle(StepVisual_HArray1OfInvisibleItem) HInvsblItm =
- new StepVisual_HArray1OfInvisibleItem (1,Styles.NbStyles());
- // put all style item into the harray
- for ( si=1; si <= Styles.NbStyles(); si++ ) {
- Handle(StepRepr_RepresentationItem) styledItm =
- Handle(StepRepr_RepresentationItem)::DownCast(Styles.Style(si));
- StepVisual_InvisibleItem anInvItem;
- anInvItem.SetValue( styledItm );
- HInvsblItm->SetValue( si, anInvItem );
- }
- // set the invisibility of items
- Invsblt->Init( HInvsblItm );
- WS->Model()->AddWithRefs( Invsblt );
- }
-
+
if (newItems->Length() > 0)
aMDGPR->SetItems( newItems );
} //end of work with CDSR
}
+ if ( !isVisible ) {
+ // create invisibility item and refer for stiledItem
+ Handle(StepVisual_Invisibility) Invsblt = new StepVisual_Invisibility();
+ Handle(StepVisual_HArray1OfInvisibleItem) HInvsblItm =
+ new StepVisual_HArray1OfInvisibleItem (1,Styles.NbStyles());
+ // put all style item into the harray
+ for ( Standard_Integer si=1; si <= Styles.NbStyles(); si++ ) {
+ Handle(StepRepr_RepresentationItem) styledItm =
+ Handle(StepRepr_RepresentationItem)::DownCast(Styles.Style(si));
+ StepVisual_InvisibleItem anInvItem;
+ anInvItem.SetValue( styledItm );
+ HInvsblItm->SetValue( si, anInvItem );
+ }
+ // set the invisibility of items
+ Invsblt->Init( HInvsblItm );
+ WS->Model()->AddWithRefs( Invsblt );
+ }
}
return Standard_True;
--- /dev/null
+puts "=========="
+puts "OCC23951"
+puts "=========="
+puts ""
+#####################################################################################
+# Visibility of free, simple shapes not saved when writing XCAF Document info STEP
+#####################################################################################
+
+pload QAcommands
+
+set info [OCC23951]
+
+if { [regexp "Write Done" $info] != 1 } {
+ puts "Error: file was not written"
+} else {
+ puts "OK: file was written"
+}
+
+stepread test_box.step a *
+axo
+fit
+
+set only_screen_axo 1