### SetWindow Method Example Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/api_doc/0.18.1/OCC.Visual3d.html Associates a window with the view. This example demonstrates the initialization and association of a view with a window, including graphic driver and view manager setup. ```python Handle_Aspect_DisplayConnection aDisplayConnection; // Display connection initialization only needed on Linux platform // and on Mac OS X, in cases when you use Xlib for windows drawing. aDisplayConnection = new Aspect_DisplayConnection(); // Graphic driver initialization Handle_Graphic3d_GraphicDriver aGraphicDriver = Graphic3d::InitGraphicDriver (aDisplayConnection); // Define a view manager Handle_Visual3d_ViewManager aVisualManager = new Visual3d_ViewManager (aGraphicDriver); // Define a view Handle_Visual3d_View aView = new Visual3d_View (aVisaulManager); // Define a window Handle_Xw_Window aWindow = new Xw_Window (aDisplayConnection, ‘Graphic View 1’, 0.695, 0.695, 0.600, 0.600, Quantity_NOC_MATRAGRAY); // Associate the view and the window aView->SetWindow (aWindow); // Map the window aWindow->Map (); // Activate the view aView->Activate (); ``` -------------------------------- ### Initialize, Display, and Fit Example Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/upstream_doc/dox/user_guides/draw_test_harness/draw_test_harness.md Initializes the viewer, creates a box, displays it, and fits the view. This is a common setup sequence. ```python vinit box b 10 10 10 vdisplay b vfit ``` -------------------------------- ### OCAF Plugin File Example Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/upstream_doc/dox/user_guides/ocaf_wp/ocaf_wp.md This is an example of a plugin file, defining required plugins and their library locations using GUIDs. ```plaintext a148e300-5740-11d1-a904-080036aaa103.Location: FWOSPlugin ! base document drivers plugin ad696000-5b34-11d1-b5ba-00a0c9064368.Location: PAppStdPlugin ad696001-5b34-11d1-b5ba-00a0c9064368.Location: PAppStdPlugin ad696002-5b34-11d1-b5ba-00a0c9064368.Location: PAppStdPlugin 47b0b826-d931-11d1-b5da-00a0c9064368.Location: PAppStdPlugin 47b0b827-d931-11d1-b5da-00a0c9064368.Location: PAppStdPlugin ``` -------------------------------- ### Initialize and Display Objects Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/upstream_doc/dox/user_guides/draw_test_harness/draw_test_harness.md Initializes the viewer, creates a box and a sphere, displays them, and fits the view. This is a common setup for many draw test harness examples. ```shell vinit box b 40 40 40 10 10 10 psphere s 20 vdisplay s b vfit ``` -------------------------------- ### Plugin Resource File Example Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/upstream_doc/dox/user_guides/foundation_classes/foundation_classes.md This file defines metadata for plug-ins, including GUIDs, library locations, and CCL/Message file paths. It's used by the Foundation classes' Load() method to locate and load services. ```plaintext ! METADATADRIVER whose value must be OS or DM. ! FW a148e300-5740-11d1-a904-080036aaa103.Location: libFWOSPlugin.so a148e300-5740-11d1-a904-080036aaa103.CCL: /adv_44/CAS/BAG/FW-K4C/inc/FWOS.ccl ! FWDM a148e301-5740-11d1-a904-080036aaa103.Location: libFWDMPlugin.so a148e301-5740-11d1-a904-080036aaa103.CCL: /adv_44/CAS/BAG/DESIGNMANAGER-K4C/inc/DMAccess.ccl|/ adv_44/CAS/BAG/DATABASE-K4C/inc/FWDMCommands.ccl a148e301-5740-11d1-a904-080036aaa103.Message: /adv_44/CAS/ BAG/DESIGNMANAGER-K4C/etc/locale/DMAccess ! Copy-Paste 5ff7dc00-8840-11d1-b5c2-00a0c9064368.Location: libCDMShapeDriversPlugin.so 5ff7dc01-8840-11d1-b5c2-00a0c9064368.Location: libCDMShapeDriversPlugin.so 5ff7dc02-8840-11d1-b5c2-00a0c9064368.Location: libCDMShapeDriversPlugin.so 5ff7dc03-8840-11d1-b5c2-00a0c9064368.Location: libCDMShapeDriversPlugin.so 5ff7dc04-8840-11d1-b5c2-00a0c9064368.Location: libCDMShapeDriversPlugin.so ! Plugs 2d plotters: d0d722a2-b4c9-11d1-b561-0000f87a4710.location: FWOSPlugin d0d722a2-b4c9-11d1-b561-0000f87a4710.CCL: /adv_44/CAS/BAG/ VIEWERS-K4C/inc/CCLPlotters.ccl d0d722a2-b4c9-11d1-b561-0000f87a4710.Message: /adv_44/CAS/ BAG/VIEWERS-K4C/etc/locale/CCLPlotters !SHAPES e3708f72-b1a8-11d0-91c2-080036424703.Location: libBRepExchangerPlugin.so e3708f72-b1a8-11d0-91c2-080036424703.CCL: /adv_44/CAS/BAG/ FW-K4C/inc/BRep.ccl ``` -------------------------------- ### Install Sphinx and Theme Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/api_doc/README.md Installs Sphinx and the Read the Docs theme using Conda. This is a prerequisite for generating documentation. ```bash $ conda install sphinx sphinx_rtd_theme ``` -------------------------------- ### BRepBuilderAPI_MakePrism Example Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/upstream_doc/dox/user_guides/modeling_algos/modeling_algos.md Constructs a prism feature. This example defines a wire and then uses BRepBuilderAPI_MakePrism to create a prism based on that wire. ```cpp BRepBuilderAPI_MakeWire mkw; gp_Pnt p1 = gp_Pnt(0.,0.,0.) gp_Pnt p2 = gp_Pnt(200.,0.,0.) mkw.Add(BRepBuilderAPI_MakeEdge(p1,p2)) p1 = p2; p2 = gp_Pnt(200.,0.,50.) mkw.Add(BRepBuilderAPI_MakeEdge(p1,p2)) p1 = p2; p2 = gp_Pnt(50.,0.,50.) mkw.Add(BRepBuilderAPI_MakeEdge(p1,p2)) p1 = p2; p2 = gp_Pnt(50.,0.,200.) mkw.Add(BRepBuilderAPI_MakeEdge(p1,p2)) p1 = p2; p2 = gp_Pnt(0.,0.,200.) mkw.Add(BRepBuilderAPI_MakeEdge(p1,p2)) p1 = p2; mkw.Add(BRepBuilderAPI_MakeEdge(p2,gp_Pnt(0.,0.,0.))) TopoDS_Shape S = BRepBuilderAPI_MakePrism(BRepBuilderAPI_MakeFace (mkw.Wire()),gp_Vec(gp_Pnt(0.,0.,0.),gp_P nt(0.,100.,0.))) ``` -------------------------------- ### Install GUI Manager (PyQt) Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/api_doc/build_install.md Install PyQt4, a recommended GUI manager for pythonocc, using conda. ```bash $ conda install pyqt ``` -------------------------------- ### Install Miniconda on Linux Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/api_doc/build_install.md Download and execute the Miniconda installer script for Linux to set up a minimal Python environment. ```bash curl 'http://repo.continuum.io/miniconda/Miniconda-3.7.0-Linux-x86_64.sh' > Miniconda.sh bash Miniconda.sh ``` -------------------------------- ### OCAF GUID Example Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/upstream_doc/dox/user_guides/ocaf/ocaf.md An example of a GUID (Global Universal ID), a string intended to uniquely identify an object. ```cpp 2a96b602-ec8b-11d0-bee7-080009dc3333 ``` -------------------------------- ### Initialize and Configure a 3D Viewer Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/upstream_doc/dox/user_guides/visualization/visualization.md This example demonstrates the initialization of a 3D viewer with a specified display connection, driver, background color, shading model, and update mode. It also includes creating a structure, a group of primitives, and lights. ```cpp //Create a default display connection Handle(Aspect_DisplayConnection) aDisplayConnection = new Aspect_DisplayConnection(); //Create a Graphic Driver from the default Aspect_DisplayConnection Handle(OpenGl_GraphicDriver) GD = new OpenGl_GraphicDriver (aDisplayConnection); //Create a Viewer to this Driver Handle(V3d_Viewer) VM = new V3d_Viewer(GD, 400., // Space size V3d_Xpos, // Default projection Quantity_NOC_DARKVIOLET, // Default background V3d_ZBUFFER, // Type of visualization V3d_GOURAUD, // Shading model V3d_WAIT); // Update mode // Create a structure in this Viewer Handle(Graphic3d_Structure) S = new Graphic3d_Structure(VM->Viewer()) ; // Type of structure S->SetVisual (Graphic3d_TOS_SHADING); // Create a group of primitives in this structure Handle(Graphic3d_Group) G = new Graphic3d_Group(S) ; // Fill this group with one polygon of size 100 Graphic3d_Array1OfVertex Points(0,3) ; Points(0).SetCoord(-100./2.,-100./2.,-100./2.) ; Points(1).SetCoord(-100./2., 100./2.,-100./2.) ; Points(2).SetCoord( 100./2., 100./2.,-100./2.) ; Points(3).SetCoord( 100./2.,-100./2.,-100./2.) ; Normal.SetCoord(0.,0.,1.) ; G->Polygon(Points,Normal) ; // Create Ambient and Infinite Lights in this Viewer Handle(V3d_AmbientLight) L1 = new V3d_AmbientLight (VM,Quantity_NOC_GRAY50) ; Handle(V3d_DirectionalLight) L2 = new V3d_DirectionalLight (VM,V3d_XnegYnegZneg,Quantity_NOC_WHITE) ; // Create a 3D quality Window with the same DisplayConnection Handle(Xw_Window) W = new Xw_Window(aDisplayConnection,"Test V3d",0.5,0.5,0.5,0.5) ; // Map this Window to this screen W->Map() ; // Create a Perspective View in this Viewer Handle(V3d_View) aView = new V3d_View(VM); aView->Camera()->SetProjectionType (Graphic3d_Camera::Projection_Perspective); // Associate this View with the Window aView ->SetWindow(W); // Display ALL structures in this View VM->Viewer()->Display(); // Finally update the Visualization in this View aView->Update(); ``` -------------------------------- ### OCC.StepGeom.StepGeom_Line.Pnt Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/api_doc/0.18.1/OCC.StepGeom.html Gets the starting point of the line. ```APIDOC ## Pnt ### Description Gets the starting point of the line. ### Return Type Handle_StepGeom_CartesianPoint ``` -------------------------------- ### Create and Get Attribute GUID Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/upstream_doc/dox/user_guides/ocaf/ocaf.md Creates a new integer attribute and retrieves its unique GUID. This GUID is essential for identifying and managing attributes within the OCAF framework. ```cpp Handle(TDataStd_Integer) INT = new TDataStd_Integer(); Standard_GUID guid = INT->ID(); ``` -------------------------------- ### Create a 3D Viewer Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/upstream_doc/dox/user_guides/visualization/visualization.md Sets up a 3D viewer with default lights, enables lighting, and sets the background color to black. This is a Windows-specific example. ```cpp // create a default connection Handle(Aspect_DisplayConnection) aDisplayConnection; // create a graphic driver from default connection Handle(OpenGl_GraphicDriver) aGraphicDriver = new OpenGl_GraphicDriver (GetDisplayConnection()); // create a viewer TCollection_ExtendedString aName ("3DV"); myViewer = new V3d_Viewer (aGraphicDriver,aName.ToExtString(), ""); // set parameters for V3d_Viewer // defines default lights - // positional-light 0.3 0.0 0.0 // directional-light V3d_XnegYposZpos // directional-light V3d_XnegYneg // ambient-light a3DViewer->SetDefaultLights(); // activates all the lights defined in this viewer a3DViewer->SetLightOn(); // set background color to black a3DViewer->SetDefaultBackgroundColor (Quantity_NOC_BLACK); ``` -------------------------------- ### Get Translation Ratio on IGES Faces Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/upstream_doc/dox/user_guides/iges/iges.md Example of using tpstat to get translation ratio specifically for IGES faces. ```bash Draw:> tpstat *l iges-faces ``` -------------------------------- ### RWStepAP203_RWStartWork Methods Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/api_doc/0.18.1/OCC.RWStepAP203.html Provides methods for reading, writing, and sharing StartWork entities in STEP format. ```APIDOC ## ReadStep ### Description Reads StartWork data from a STEP file. ### Parameters - **data** (Handle_StepData_StepReaderData &) – The STEP reader data. - **num** (int) – The entity number. - **ach** (Handle_Interface_Check &) – The check interface. - **ent** (Handle_StepAP203_StartWork &) – The StartWork entity to read. ### Return type None ## Share ### Description Fills data for the graph, specifically for shared items related to a StartWork entity. ### Parameters - **ent** (Handle_StepAP203_StartWork &) – The StartWork entity. - **iter** (Interface_EntityIterator &) – The entity iterator. ### Return type None ## WriteStep ### Description Writes StartWork data to a STEP file. ### Parameters - **SW** (StepData_StepWriter &) – The STEP writer. - **ent** (Handle_StepAP203_StartWork &) – The StartWork entity to write. ### Return type None ``` -------------------------------- ### BRepApprox_TheComputeLineBezierOfApprox.Init Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/api_doc/0.18.1/OCC.BRepApprox.html Initializes the approximation process with various parameters. ```APIDOC ## Init ### Description Initializes the approximation process with parameters controlling degree, tolerance, iterations, and approximation strategy. ### Parameters * **degreemin** (_int_) - The minimum degree for the approximation. Defaults to 4. * **degreemax** (_int_) - The maximum degree for the approximation. Defaults to 8. * **Tolerance3d** (_float_) - The 3D tolerance for approximation. Defaults to 1.0e-03. * **Tolerance2d** (_float_) - The 2D tolerance for approximation. Defaults to 1.0e-06. * **NbIterations** (_int_) - The number of iterations for the approximation. Defaults to 5. * **cutting** (_bool_) - Whether to enable cutting. Defaults to Standard_True. * **parametrization** (_Approx_ParametrizationType_) - The type of parametrization to use. Defaults to Approx_ChordLength. * **Squares** (_bool_) - Whether to use squares for approximation. Defaults to Standard_False. ### Return Type [None](https://docs.python.org/2/library/constants.html#None) ``` -------------------------------- ### Get Shape ID Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/api_doc/0.18.1/OCC.TDataXtd.html Returns the GUID associated with the Shape. ```APIDOC ## Get Shape ID ### Description Returns the GUID associated with the Shape. ### Method `TDataXtd_Shape_GetID()` ### Return Type Standard_GUID ``` -------------------------------- ### Proj.NearestPoint() Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/upstream_doc/dox/user_guides/modeling_algos/modeling_algos.md Get the nearest solution point to the starting point. ```APIDOC ## Proj.NearestPoint() ### Description Returns the solution point that is closest to the initial starting point. ### Method Call ### Endpoint N/A (SDK Method) ### Parameters None ### Request Example ```python p1 = Proj.NearestPoint() ``` ### Response - **p1** (gp_Pnt) - The nearest solution point. ``` -------------------------------- ### Interface_GeneralLib.Start Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/api_doc/0.18.1/OCC.Interface.html Starts the general library. ```APIDOC ## Start() ### Description Starts the general library. ### Return type [None] ``` -------------------------------- ### Initialize VTK Viewer Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/upstream_doc/dox/user_guides/draw_test_harness/draw_test_harness.md Creates a window for the VTK viewer. ```bash ivtkinit ``` -------------------------------- ### StepAP203_StartWork.Init Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/api_doc/0.18.1/OCC.StepAP203.html Initializes all fields (own and inherited) for StepAP203_StartWork. ```APIDOC ## StepAP203_StartWork.Init ### Description Initialize all fields (own and inherited). ### Parameters #### Path Parameters - **aActionAssignment_AssignedAction** (Handle_StepBasic_Action &) – - **aItems** (Handle_StepAP203_HArray1OfWorkItem &) – ### Return Type [None](https://docs.python.org/2/library/constants.html#None "(in Python v2.7)") ``` -------------------------------- ### Get Entity Label by Number Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/upstream_doc/dox/user_guides/draw_test_harness/draw_test_harness.md The 'elabel' command retrieves the label for an entity given its number. For STEP files, labels start with '#', and for IGES files, they start with 'D'. ```draw elabel 84 ``` -------------------------------- ### Get Nearest Projection Solution Point Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/upstream_doc/dox/user_guides/modeling_algos/modeling_algos.md Retrieve the projection solution point that is closest to the initial starting point. ```python p1 = Proj.NearestPoint() ``` -------------------------------- ### TopOpeBRepBuild_FaceBuilder.InitWire Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/api_doc/0.18.1/OCC.TopOpeBRepBuild.html Initializes wire processing. ```APIDOC ## InitWire() ### Return type [int](https://docs.python.org/2/library/functions.html#int "(in Python v2.7)") ``` -------------------------------- ### GetFromTransfer Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/api_doc/0.18.1/OCC.Interface.html Gets contents from an EntityIterator, prepared by a Transfer tool (e.g., TransferCopy). This process starts from a clear state. ```APIDOC ## GetFromTransfer ### Description Gets contents from an EntityIterator, prepared by a Transfer tool (e.g TransferCopy). Starts from clear. ### Parameters * **aniter** (_Interface_EntityIterator &_) – ### Return type [None](https://docs.python.org/2/library/constants.html#None "(in Python v2.7)") ``` -------------------------------- ### BRepFeat_MakeRevol Example Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/upstream_doc/dox/user_guides/modeling_algos/modeling_algos.md Constructs a revolution feature. Ensure the base shape, revolution axis, and other parameters are correctly defined. ```cpp BRepFeat_MakeRevol theRevol(Sbase, Frevol, TopoDS_Face(), RevolAx, Standard_True, Standard_True) theRevol.Perform(FUntil) if (theRevol.IsDone()) { TopoDS_Shape theResult = theRevol; ... } ``` -------------------------------- ### StepBasic_Organization.Init Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/api_doc/0.18.1/OCC.StepBasic.html Initializes an Organization with ID, name, and description. ```APIDOC ## Init ### Description Initializes an Organization with ID, name, and description. ### Parameters - **hasAid** (bool) - Indicates if an ID is present. - **aId** (Handle_TCollection_HAsciiString &) - The ID of the organization. - **aName** (Handle_TCollection_HAsciiString &) - The name of the organization. - **aDescription** (Handle_TCollection_HAsciiString &) - The description of the organization. ### Return type void ``` -------------------------------- ### Get Transformation ID Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/upstream_doc/dox/user_guides/ocaf/ocaf.md Returns the unique GUID of the transformation attribute, used for identification among other attributes attached to the same label. ```cpp const Standard_GUID& MyPackage_Transformation::ID() const { return GetID(); } ``` -------------------------------- ### Get Edge Vertices Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/upstream_doc/dox/user_guides/modeling_algos/modeling_algos.md Retrieves the start and end vertices of an edge. These vertices can be null if the edge is open in a particular direction. ```cpp Vertex1() Vertex2() ``` -------------------------------- ### InitShow Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/api_doc/0.18.1/OCC.HLRBRep.html Initializes the visible line calculation process. ```APIDOC ## InitShow ### Description Initializes the visible line calculation process. ### Return Type None ``` -------------------------------- ### TopOpeBRepTool_makeTransition.Initialize Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/api_doc/0.18.1/OCC.TopOpeBRepTool.html Initializes the transition. ```APIDOC ## Initialize ### Description Initializes the transition. ### Parameters #### Path Parameters - **E** (TopoDS_Edge &) - Description of the edge parameter. - **pbef** (float) - Description of the pbef parameter. - **paft** (float) - Description of the paft parameter. - **parE** (float) - Description of the parE parameter. - **FS** (TopoDS_Face &) - Description of the FS parameter. - **uv** (gp_Pnt2d) - Description of the uv parameter. - **factor** (float) - Description of the factor parameter. ### Return type [bool](https://docs.python.org/2/library/functions.html#bool "in Python v2.7") ``` -------------------------------- ### Get Main Partition Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/upstream_doc/dox/user_guides/tobj/tobj.md Retrieves the main partition of the model. This is often the starting point for accessing child objects or other partition-related operations. ```cpp Handle(TObj_Partition) GetMainPartition() const; ``` -------------------------------- ### Numerical Solver Usage Example Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/upstream_doc/dox/user_guides/foundation_classes/foundation_classes.md Demonstrates the usage of a numerical solver, checking for successful completion and retrieving the root. ```cpp main() { myFunction f(1.0, 0.0, 4.0); math_BissecNewton sol(F, 1.5, 2.5, 0.000001); if(Sol.IsDone()) { // is it OK ? Standard_Real x = sol.Root(); // yes. } else { // no } } ``` -------------------------------- ### OCAF Resource File Example Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/upstream_doc/dox/user_guides/ocaf_wp/ocaf_wp.md This is an example of a resource file that declares a new model document for an OCAF application. It specifies the document format, description, file extension, and the GUIDs for storage, retrieval, schema, attribute storage, and attribute retrieval plugins. ```plaintext formatlist:OCAF-MyApplication OCAF-MyApplication.Description: MyApplication Document Version 1.0 OCAF-MyApplication.FileExtension: sta OCAF-MyApplication.StoragePlugin: ad696000-5b34-11d1-b5ba-00a0c9064368 OCAF-MyApplication.RetrievalPlugin: ad696001-5b34-11d1-b5ba-00a0c9064368 OCAF-MyApplicationSchema: ad696002-5b34-11d1-b5ba-00a0c9064368 OCAF-MyApplication.AttributeStoragePlugin: 47b0b826-d931-11d1-b5da-00a0c9064368 OCAF-MyApplication.AttributeRetrievalPlugin: 47b0b827-d931-11d1-b5da-00a0c9064368 ``` -------------------------------- ### Init Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/api_doc/0.18.1/OCC.STEPConstruct.html Initializes the tool. Returns True if initialization succeeded. ```APIDOC ## Init ### Description Initializes tool; returns True if succeeded. ### Parameters * **WS** (Handle_XSControl_WorkSession &) – ### Return Type [bool](https://docs.python.org/2/library/functions.html#bool "in Python v2.7") ``` -------------------------------- ### Init Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/api_doc/0.18.1/OCC.Adaptor3d.html Initializes the tool. ```APIDOC ## Init ### Description Initializes the tool. ### Method (Method details not specified in source) ### Parameters (No parameters specified in source) ### Response void ``` -------------------------------- ### Set UAttribute and Get UAttribute Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/upstream_doc/dox/user_guides/draw_test_harness/draw_test_harness.md Commands to create or find a UAttribute at a specified entry using a local GUID. Use for managing unique attributes. ```draw set localGUID "c73bd076-22ee-11d2-acde-080009dc4422" SetUAttribute D 0:2 ${localGUID} ``` ```draw set localGUID "c73bd076-22ee-11d2-acde-080009dc4422" GetUAttribute D 0:2 ${localGUID} ``` -------------------------------- ### Build and Update with HLRBRep_PolyAlgo Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/upstream_doc/dox/user_guides/modeling_algos/modeling_algos.md Shows how to instantiate HLRBRep_PolyAlgo, load shapes, set a projector, update the HLR, and prepare for edge extraction. ```python # Build The algorithm object myPolyAlgo = new HLRBRep_PolyAlgo() # Add Shapes into the algorithm TopTools_ListIteratorOfListOfShape anIterator(myListOfShape) for (;anIterator.More()anIterator.Next()) myPolyAlgo-Load(anIterator.Value()) # Set The Projector (myProjector is a HLRAlgo_Projector) myPolyAlgo->Projector(myProjector) # Build HLR myPolyAlgo->Update() # Build the extraction object : HLRBRep_PolyHLRToShape aPolyHLRToShape; aPolyHLRToShape.Update(myPolyAlgo) ``` -------------------------------- ### Init Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/api_doc/0.18.1/OCC.BRepOffsetAPI.html Initializes the framework with a given shape. ```APIDOC ## Init ### Description Initializes the empty constructor framework with the shape S. ### Parameters * **S** (TopoDS_Shape &) - The shape to initialize the framework with. ### Returns None ``` -------------------------------- ### Get an Application and New XDE Document Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/upstream_doc/dox/user_guides/xde/xde.md Retrieve an existing XCAFApp_Application instance and create a new TDocStd_Document initialized for XDE. This is a common starting point for XDE operations. ```cpp Handle(TDocStd_Document) aDoc; Handle(XCAFApp_Application) anApp = XCAFApp_Application::GetApplication(); anApp->NewDocument(;MDTV-XCAF;,aDoc); ``` -------------------------------- ### Get List of Signatures Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/api_doc/0.18.1/OCC.IFSelect.html Returns the list of signatures as a sequence of strings, ordered and without their respective counts. Optionally, filters signatures starting with a given root string. ```APIDOC ## List ### Description Returns the list of signatures, as a sequence of strings (but without their respective counts). It is ordered. By default, for all the signatures. If is given non empty, for the signatures which begin by . ### Parameters * **root** (_char *_) – Optional root string to filter signatures. Defaults to an empty string. ### Return type [Handle_TColStd_HSequenceOfHAsciiString](OCC.TColStd.html#OCC.TColStd.Handle_TColStd_HSequenceOfHAsciiString "OCC.TColStd.Handle_TColStd_HSequenceOfHAsciiString") ``` -------------------------------- ### TopOpeBRepTool_face.Init Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/api_doc/0.18.1/OCC.TopOpeBRepTool.html Initializes the face with a wire and a reference face. ```APIDOC ## Init ### Description Initializes the face with a wire and a reference face. ### Parameters #### Path Parameters - **W** (TopoDS_Wire &) - Description of the wire parameter. - **Fref** (TopoDS_Face &) - Description of the reference face parameter. ### Return type [bool](https://docs.python.org/2/library/functions.html#bool "in Python v2.7") ``` -------------------------------- ### load_any_qt_backend Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/api_doc/0.18.1/OCC.Display.backend.html Loads any available Qt-based backend in a preferred order. ```APIDOC ## load_any_qt_backend() ### Description Loads any Qt-based backend. It tries to load PyQt5 first, then PyQt4, and finally PySide. Raises an exception if none are available. ### Method ```python load_any_qt_backend() ``` ``` -------------------------------- ### Get Face Construction Status Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/api_doc/0.18.1/OCC.BRepBuilderAPI.html Retrieves the status of the face construction. Returns BRepBuilderAPI_FaceDone if successful, or an error code from the BRepBuilderAPI_FaceError enumeration if construction failed, for example, due to parameters being out of range. ```cpp MF.Error() ``` -------------------------------- ### Init Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/api_doc/0.18.1/OCC.AIS.html Initializes the selection. ```APIDOC ## Init ### Return type [None](https://docs.python.org/2/library/constants.html#None "(in Python v2.7)") `Init`()[¶](#OCC.AIS.AIS_Selection.Init "Permalink to this definition") ``` -------------------------------- ### TCollection_AsciiString.SubString Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/api_doc/0.18.1/OCC.TCollection.html Creates a sub-string of the current AsciiString. The sub-string starts at FromIndex and ends at ToIndex. Raises an exception if FromIndex or ToIndex is out of bounds. Example: before me = ‘abcdefg’, ToIndex=3, FromIndex=6 after me = ‘abcdefg’ returns ‘cdef’. ```APIDOC ## SubString ### Description Creation of a sub-string of the string . The sub-string starts to the index Fromindex and ends to the index ToIndex. Raises an exception if ToIndex or FromIndex is out of bounds Example: aString contains ‘abcdefg’ aString.SubString(3,6) returns ‘cdef’ ### Parameters #### Path Parameters - **FromIndex** (int) - Required - - **ToIndex** (int) - Required - ### Return type [TCollection_AsciiString] ``` -------------------------------- ### SetUp Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/api_doc/0.18.1/OCC.V3d.html Defines the orientation of the high point. ```APIDOC ## SetUp ### Description Defines the orientation of the high point. ### Parameters #### Path Parameters - **Vx** (Quantity_Parameter) - Required - The x-component of the orientation vector. - **Vy** (Quantity_Parameter) - Required - The y-component of the orientation vector. - **Vz** (Quantity_Parameter) - Required - The z-component of the orientation vector. ### Return Type [None](https://docs.python.org/2/library/constants.html#None "in Python v2.7") ## SetUp ### Description Defines the orientation (SO) of the high point. ### Parameters #### Path Parameters - **Orientation** (V3d_TypeOfOrientation) - Required - The type of orientation. ### Return Type [None](https://docs.python.org/2/library/constants.html#None "in Python v2.7") ``` -------------------------------- ### Transformation Attribute Implementation in CDL Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/upstream_doc/dox/user_guides/ocaf/ocaf.md This CDL code defines a Transformation attribute for implementing transformation data containers. It includes methods for getting the attribute's GUID, setting the attribute on a label, and accessing or setting transformation data like rotation, translation, mirroring, and scaling. ```cdl class Transformation from MyPackage inherits Attribute from TDF ---Purpose: This attribute implements a transformation data container. uses Attribute from TDF, Label from TDF, GUID from Standard, RelocationTable from TDF, Pnt from gp, Ax1 from gp, Ax2 from gp, Ax3 from gp, Vec from gp, Trsf from gp, TrsfForm from gp is ---Category: Static methods -- =============== GetID (myclass) ---C++: return const & ---Purpose: The method returns a unique GUID of this attribute. -- By means of this GUID this attribute may be identified -- among other attributes attached to the same label. returns GUID from Standard; Set (myclass; theLabel : Label from TDF) ---Purpose: Finds or creates the attribute attached to . -- The found or created attribute is returned. returns Transformation from MyPackage; ---Category: Methods for access to the attribute data -- ======================================== Get (me) ---Purpose: The method returns the transformation. returns Trsf from gp; ---Category: Methods for setting the data of transformation -- ============================================== SetRotation (me : mutable; theAxis : Ax1 from gp; theAngle : Real from Standard); ---Purpose: The method defines a rotation type of transformation. SetTranslation (me : mutable; theVector : Vec from gp); ---Purpose: The method defines a translation type of transformation. SetMirror (me : mutable; thePoint : Pnt from gp); ---Purpose: The method defines a point mirror type of transformation -- (point symmetry). SetMirror (me : mutable; theAxis : Ax1 from gp); ---Purpose: The method defines an axis mirror type of transformation -- (axial symmetry). SetMirror (me : mutable; thePlane : Ax2 from gp); ---Purpose: The method defines a point mirror type of transformation -- (planar symmetry). SetScale (me : mutable; thePoint : Pnt from gp; theScale : Real from Standard); ``` -------------------------------- ### Load Default Plugin Example Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/upstream_doc/dox/user_guides/draw_test_harness/draw_test_harness.md This command loads the default 'DrawPlugin' file and the 'DEFAULT' key, which typically maps to the TKTopTest toolkit for basic modeling commands. ```bash Draw[] pload (equivalent to pload -DrawPlugin DEFAULT). ``` -------------------------------- ### start_server Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/api_doc/0.18.1/OCC.Display.WebGl.simple_server.html Starts a simple web server. The server will only start if the PYTHONOCC_SHUNT_WEB_SERVER environment variable is not set. It allows specifying the port, the path to serve, and whether to automatically open a web browser. ```APIDOC ## start_server(port=8080, path='.', open_webbrowser=False) ### Description Starts a simple web server. ### Parameters #### Path Parameters - **port** (integer) - Optional - The port number to use for the server. Defaults to 8080. The function will attempt to find an available port if the specified one is not free. - **path** (string) - Optional - The directory path to serve files from. Defaults to the current directory ('.'). - **open_webbrowser** (boolean) - Optional - If True, automatically opens a web browser to the server's URL. Defaults to False. ### Returns - None ``` -------------------------------- ### Invisible GUID Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/api_doc/0.18.1/OCC.XCAFDoc.html Retrieves the GUID for invisibility attributes. ```APIDOC ## static InvisibleGUID() ### Description Returns GUID for invisibility attributes. ### Return Type [Standard_GUID](OCC.Standard.html#OCC.Standard.Standard_GUID "OCC.Standard.Standard_GUID") ``` -------------------------------- ### Init Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/api_doc/0.18.1/OCC.StepGeom.html Initializes the QuasiUniformSurfaceAndRationalBSplineSurface with detailed surface parameters. ```APIDOC ## Init ### Description Initializes the QuasiUniformSurfaceAndRationalBSplineSurface with detailed surface parameters. ### Parameters #### Path Parameters - **aName** (Handle_TCollection_HAsciiString &) - The name of the surface. - **aUDegree** (int) - The degree of the surface in the U-direction. - **aVDegree** (int) - The degree of the surface in the V-direction. - **aControlPointsList** (Handle_StepGeom_HArray2OfCartesianPoint &) - The array of control points. - **aSurfaceForm** (StepGeom_BSplineSurfaceForm) - The form of the B-spline surface. - **aUClosed** (StepData_Logical) - Indicates if the surface is closed in the U-direction. - **aVClosed** (StepData_Logical) - Indicates if the surface is closed in the V-direction. - **aSelfIntersect** (StepData_Logical) - Indicates if the surface self-intersects. - **aQuasiUniformSurface** (Handle_StepGeom_QuasiUniformSurface &) - The quasi-uniform surface component. - **aRationalBSplineSurface** (Handle_StepGeom_RationalBSplineSurface &) - The rational B-spline surface component. - **aWeightsData** (Handle_TColStd_HArray2OfReal &) - The array of weights for the rational B-spline surface. ### Return Type void ``` -------------------------------- ### TDF_IDList.Append (GUID) Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/api_doc/0.18.1/OCC.TDF.html Appends a single GUID to the TDF_IDList. ```APIDOC ## Append ### Description Appends a single GUID to the TDF_IDList. ### Parameters * **I** (Standard_GUID &) - The GUID to append. ### Return type None ``` -------------------------------- ### Material Reference GUID Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/api_doc/0.18.1/OCC.XCAFDoc.html Retrieves the GUID for material references. ```APIDOC ## static MaterialRefGUID() ### Description Returns GUID for material references. ### Return Type [Standard_GUID](OCC.Standard.html#OCC.Standard.Standard_GUID "OCC.Standard.Standard_GUID") ``` -------------------------------- ### Init Method Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/api_doc/0.18.1/OCC.StepBasic.html Initializes the StepBasic Address object with various components. ```APIDOC ## Init ### Description Initializes the StepBasic Address object with optional address components. ### Parameters * **hasAinternalLocation** (_bool_) – Indicates if internal location is present. * **aInternalLocation** (_Handle_TCollection_HAsciiString &_) – The internal location string. * **hasAstreetNumber** (_bool_) – Indicates if street number is present. * **aStreetNumber** (_Handle_TCollection_HAsciiString &_) – The street number string. * **hasAstreet** (_bool_) – Indicates if street is present. * **aStreet** (_Handle_TCollection_HAsciiString &_) – The street string. * **hasApostalBox** (_bool_) – Indicates if postal box is present. * **aPostalBox** (_Handle_TCollection_HAsciiString &_) – The postal box string. * **hasAtown** (_bool_) – Indicates if town is present. * **aTown** (_Handle_TCollection_HAsciiString &_) – The town string. * **hasAregion** (_bool_) – Indicates if region is present. * **aRegion** (_Handle_TCollection_HAsciiString &_) – The region string. * **hasApostalCode** (_bool_) – Indicates if postal code is present. * **aPostalCode** (_Handle_TCollection_HAsciiString &_) – The postal code string. * **hasAcountry** (_bool_) – Indicates if country is present. * **aCountry** (_Handle_TCollection_HAsciiString &_) – The country string. * **hasAfacsimileNumber** (_bool_) – Indicates if facsimile number is present. * **aFacsimileNumber** (_Handle_TCollection_HAsciiString &_) – The facsimile number string. ``` -------------------------------- ### Configure project with CMake Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/api_doc/build_install.md Use CMake to configure the build process. Specify OCE include and library paths if they differ from default locations. ```bash cmake .. cmake -DOCE_INCLUDE_PATH=/your_oce_headers -DOCE_LIB_PATH=/your_lib_dir .. ``` -------------------------------- ### Layer Reference GUID Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/api_doc/0.18.1/OCC.XCAFDoc.html Retrieves the GUID for layer references. ```APIDOC ## static LayerRefGUID() ### Description Returns GUID for layer references. ### Return Type [Standard_GUID](OCC.Standard.html#OCC.Standard.Standard_GUID "OCC.Standard.Standard_GUID") ``` -------------------------------- ### Initialize Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/api_doc/0.18.1/OCC.Extrema.html Initializes the extrema calculation process with surface and grid parameters. ```APIDOC ## Initialize(S, NbU, NbV, TolU, TolV) ### Parameters * **S** (_Adaptor3d_Surface &_) – * **NbU** (_int_) – * **NbV** (_int_) – * **TolU** (_float_) – * **TolV** (_float_) – ### Return type [None](https://docs.python.org/2/library/constants.html#None "(in Python v2.7)") ``` ```APIDOC ## Initialize(S, NbU, NbV, Umin, Usup, Vmin, Vsup, TolU, TolV) ### Parameters * **S** (_Adaptor3d_Surface &_) – * **NbU** (_int_) – * **NbV** (_int_) – * **Umin** (_float_) – * **Usup** (_float_) – * **Vmin** (_float_) – * **Vsup** (_float_) – * **TolU** (_float_) – * **TolV** (_float_) – ### Return type [None](https://docs.python.org/2/library/constants.html#None "(in Python v2.7)") ``` -------------------------------- ### Assembly GUID Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/api_doc/0.18.1/OCC.XCAFDoc.html Retrieves the GUID for a UAttribute identifying an assembly. ```APIDOC ## static AssemblyGUID() ### Description Returns GUID for UAttribute identifying assembly. ### Return Type [Standard_GUID](OCC.Standard.html#OCC.Standard.Standard_GUID "OCC.Standard.Standard_GUID") ``` -------------------------------- ### GeomFill_GuideTrihedronPlan Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/api_doc/0.18.1/OCC.GeomFill.html Defines a trihedron with a guide for planar type guides. ```APIDOC ## class GeomFill_GuideTrihedronPlan Bases: `OCC.GeomFill.GeomFill_TrihedronWithGuide` ### Parameters **theGuide** (_Handle_Adaptor3d_HCurve &_) – ### Return type [None](https://docs.python.org/2/library/constants.html#None "(in Python v2.7)") ### Methods `GetHandle()` `thisown` The membership flag ``` -------------------------------- ### Create Data Framework Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/upstream_doc/dox/user_guides/draw_test_harness/draw_test_harness.md Initializes a new data framework with a given name. This is the first step in organizing data within the framework. ```draw MakeDF D ``` -------------------------------- ### Revolution Initialization with BRepFeat_MakeRevol Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/upstream_doc/dox/user_guides/modeling_algos/modeling_algos.md Initialize a revolution operation using BRepFeat_MakeRevol. This snippet shows the necessary parameters for setting up the revolution. ```cpp TopoDS_Shape Sbase = ...; # an initial shape TopoDS_Face Frevol = ....; # a base of prism TopoDS_Face FUntil = ....; # face limiting the revol gp_Dir RevolDir (.,.,.) gp_Ax1 RevolAx(gp_Pnt(.,.,.), RevolDir) ``` -------------------------------- ### xcafdoc Assembly GUID Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/api_doc/0.18.1/OCC.XCAFDoc.html Returns the GUID for a UAttribute identifying an assembly. ```APIDOC ## xcafdoc_AssemblyGUID() ### Description Returns GUID for UAttribute identifying assembly. ### Return Type [Standard_GUID](OCC.Standard.html#OCC.Standard.Standard_GUID "OCC.Standard.Standard_GUID") ``` -------------------------------- ### Initialize algorithm with C, Deflection, Resolution, and WithControl (3D) Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/api_doc/0.18.1/OCC.CPnts.html Initializes the algorithm with a 3D curve , a deflection value , a resolution , and a control flag . ```APIDOC ## Initialize algorithm with C, Deflection, Resolution, and WithControl (3D) ### Description Initializes the algorithm with a 3D curve , a deflection value , a resolution , and a control flag . ### Parameters * **C** (_Adaptor3d_Curve &_) – The 3D curve. * **Deflection** ([_float_]) – The deflection value. * **Resolution** ([_float_]) – The resolution for computation. * **WithControl** ([_bool_]) – If True, controls estimated deflection at singular points. ``` -------------------------------- ### TDF_IDList.InsertAfter (GUID) Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/api_doc/0.18.1/OCC.TDF.html Inserts a GUID after a specified iterator position in the TDF_IDList. ```APIDOC ## InsertAfter ### Description Inserts a GUID after a specified iterator position in the TDF_IDList. ### Parameters * **I** (Standard_GUID &) - The GUID to insert. * **It** (TDF_ListIteratorOfIDList &) - The iterator indicating the position after which to insert. ### Return type None ``` -------------------------------- ### Shape Reference GUID Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/api_doc/0.18.1/OCC.XCAFDoc.html Retrieves the GUID for a TreeNode representing an assembly link. ```APIDOC ## static ShapeRefGUID() ### Description Returns GUID for TreeNode representing assembly link. ### Return Type [Standard_GUID](OCC.Standard.html#OCC.Standard.Standard_GUID "OCC.Standard.Standard_GUID") ``` -------------------------------- ### PluginFactory Implementation using DPLUGIN Macro Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/upstream_doc/dox/user_guides/draw_test_harness/draw_test_harness.md Example of implementing a plug-in for the Draw Test Harness. It includes the necessary header, the Package::Factory method to activate commands, and the DPLUGIN macro to declare the entry point. ```cpp #include void MyPack::Factory(Draw_Interpretor& theDI) { ... // MyPack::CurveCommands(theDI); ... } // Declare entry point PLUGINFACTORY DPLUGIN(MyPack) ``` -------------------------------- ### GeomFill_GuideTrihedronAC Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/api_doc/0.18.1/OCC.GeomFill.html Defines a trihedron with a guide for AC (Arbitrary Curve) type guides. ```APIDOC ## class GeomFill_GuideTrihedronAC Bases: `OCC.GeomFill.GeomFill_TrihedronWithGuide` ### Parameters **guide** (_Handle_Adaptor3d_HCurve &_) – ### Return type [None](https://docs.python.org/2/library/constants.html#None "(in Python v2.7)") ### Methods `GetHandle()` `thisown` The membership flag ``` -------------------------------- ### Init Method Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/api_doc/0.18.1/OCC.GeomAPI.html Initializes the approximation algorithm. ```APIDOC ## Init() ### Description Initializes the approximation algorithm. ### Return type None ``` -------------------------------- ### Launch IPython with Qt GUI Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/api_doc/five_minutes.md Starts the IPython console with Qt integration for interactive pythonocc sessions. This is the recommended way to use pythonocc for GUI-dependent operations. ```bash $ ipython --gui='qt' ``` -------------------------------- ### Datum Reference GUID Source: https://github.com/tpaviot/pythonocc-documentation/blob/master/api_doc/0.18.1/OCC.XCAFDoc.html Retrieves GUIDs for TreeNodes representing specified types of datum. ```APIDOC ## static DatumRefGUID() ### Description Return GUIDs for TreeNode representing specified types of datum. ### Return Type [Standard_GUID](OCC.Standard.html#OCC.Standard.Standard_GUID "OCC.Standard.Standard_GUID") ```