Import from CAD formats
-----------------------
-It is possible to import files in the following CAD-neutral formats: BREP, STEP, IGES, XAO.
+It is possible to import files in the following CAD-neutral formats: BREP, STEP, IGES, XAO, STL.
To import a file into active part select in the Main Menu *File -> Import -> From CAD format...* item.
The following property panel will be opened:
Import of BREP file.
+Import pictures
+-----------------------
+
+It is possible to import pictures in the following image formats: GIF, TIFF, PNG, JPG, JPEG, BMP, PPM, JPE.
+To import a file into active part select in the Main Menu *File -> Import -> Picture...* item.
+
+Result
+""""""
+
+.. figure:: images/imageImported.png
+ :align: center
+
+ Import of PNG image file.
+
**See Also** a sample TUI Script of :ref:`tui_import_file` operation.
Handle(AIS_InteractiveObject) anAIS = thePrs->impl<Handle(AIS_InteractiveObject)>();
if (!anAIS.IsNull())
{
- std::vector<int> aColor = {167, 167, 167 };
- thePrs->setColor(aColor[0], aColor[1], aColor[2]);
- Quantity_Color myShadingColor(NCollection_Vec3<float>(aColor[0]/255., aColor[1]/255., aColor[2]/255.));
-
+ /// set color to white and change material aspect,
+ /// in order to keep a natural apect of the image.
+ thePrs->setColor(255, 255, 255);
+ Quantity_Color myShadingColor(NCollection_Vec3<float>(1., 1., 1.));
Handle(AIS_Shape) anAISShape = Handle(AIS_Shape)::DownCast(anAIS);
if (!anAISShape.IsNull())
{
- auto myDrawer = new Prs3d_ShadingAspect();
- if (!anAISShape->Attributes()->HasOwnShadingAspect())
- {
- anAISShape->Attributes()->SetShadingAspect (myDrawer);
- }
+ auto myDrawer = anAISShape->Attributes();
- myDrawer->SetColor(myShadingColor);
+ myDrawer->ShadingAspect()->SetColor(myShadingColor);
+ myDrawer->ShadingAspect()->Aspect()->SetDistinguishOn();
+ Graphic3d_MaterialAspect aMatAspect(Graphic3d_NOM_PLASTIC);
+ aMatAspect.SetTransparency(0.0);
+ myDrawer->ShadingAspect()->Aspect()->SetFrontMaterial(aMatAspect);
+ myDrawer->ShadingAspect()->Aspect()->SetBackMaterial(aMatAspect);
Handle(Image_PixMap) aPixmap;
QPixmap px(aResult->getTextureFile().c_str());
+
if (!px.isNull() )
- aPixmap = OCCViewer_Utilities::imageToPixmap( px.toImage() );
+ aPixmap = OCCViewer_Utilities::imageToPixmap( px.toImage());
anAISShape->Attributes()->ShadingAspect()->Aspect()->SetTextureMap
(new Graphic3d_Texture2Dmanual(aPixmap));