Distributive Systems |
Placing Physical String Parts |
![]() |
This use case is intended to show you how to place a physical string parts from reference string parts using the RouteStringPartInSpace routine. This macro opens the document CAAPspEduStringParts.CATProduct. Using the root node of the document it finds the tubing work package (parent product) and the piping work package. In the tubing work package it finds a straight tube and tube with bends and places a new version of each. Likewise, in the piping work package it finds a straight light pipe and light pipe with bends and places a new version of each. |
![]() |
CAAPspPlaceStringParts is launched in CATIA [1]. No open document is needed. CAAPspPlaceStringParts.CATScript is located in the CAAScdPspUseCases module. Execute macro (windows only). |
![]() |
CAAPspPlaceStringParts includes the following steps:
Setup EnvironmentThe macro first loads Distributive System document CAAPspEduStringParts.CATProduct containing a Tubing and a Piping work package each work package contains runs and string parts. Note: To open a different document, modify the variable sDocPath to point to the directory and sDocFullPath to point to full path name of the document. ... ' ***************************************************************************** '--- Main routine ' ***************************************************************************** Sub CATMain() ' ------------------------------------------------------------------------- ' Setup the Environment ' ------------------------------------------------------------------------- ' Open the Distributive system document dim sDocPath As String dim sDocFullPath As String sDocPath=CATIA.SystemService.Environ("CATDocView") If (Not CATIA.FileSystem.FolderExists(sDocPath)) Then End If ShowTraceOutputLine "Doc path = " & sDocPath sDocFullPath = CATIA.FileSystem.ConcatenatePaths(sDocPath, _ "online\CAAScdPspUseCases\samples\StringParts\CAAPspEduStringParts.CATProduct" ) ShowTraceOutputLine "Doc full path = " & sDocFullPath Set gPspDoc = CATIA.Documents.Open(sDocFullPath) If (gPspDoc Is Nothing) Then Err.Raise 9999,sDocPath,"No Document Open" End If ShowTraceOutputLine "Output traces from CAAPspPlacePart.CATScript" ... Next, the macro acquires the plant-ship modeler workbench object from the document using the top node of the object tree in a Distributive System document.. ... ' Find the top node of the Distributive System object tree - . Set gRootProduct = gPspDoc.Product If (gRootProduct Is Nothing) Then Err.Raise 9999,sDocPath,"Unable to get root product" End If ' Get Plant-ship modeler workbench Set gPspWorkbench = gRootProduct.GetTechnologicalObject ("PspWorkbench") If (gPspWorkbench Is Nothing) Then Err.Raise 9999,sDocPath,"Unable to get PspWorkbench" End If ShowTraceOutputLine "Success in getting PspWorkbench" ... Setup Application DataNow the macro sets up some data related to the tubing and piping applications. It retrieves the tubing and piping application objects used to access application methods and data. It also get a list factory which is used to create lists that hold data to be sent to the RouteStringPartInSpace routine. Note that the list factory is based on the tubing application object but it would work just as well from any plant-ship application object. ... ' ------------------------------------------------------------------------- ' ------------------------------------------------------------------------- ' Setup application data ' ------------------------------------------------------------------------- ' Get tubing application Dim objPspApplicationTub As PspApplication Set objPspApplicationTub = GetApplication(catPspIDLCATTubing) ' Get piping application Dim objPspApplicationPip As PspApplication Set objPspApplicationPip = GetApplication(catPspIDLCATPiping) ' Get gListFactory Set gListFactory = gPspWorkbench.GetInterface("CATIAPspTempListFactory", objPspApplicationTub ) If (gListFactory Is Nothing) Then Err.Raise 9999,sDocPath,"Unable to get list factory" End If ... Get Part Parent ProductsNext the macro gets the tubing and piping work packages, called parent products in the code. The work packages already exist in the model and are found by using the FindProduct function to search the children of the root product by name. ... '----------------------------------------------------------------------- ' Get part parent products. '----------------------------------------------------------------------- ' Get root product children and parent products for placed part Dim ParentProductTub As Product Set ParentProductTub = FindProduct(gRootProduct, "CAAPspEduTubes.1") If (ParentProductTub Is Nothing) Then Err.Raise 9999,sDocPath,"Unable to get tubing parent product" End If ShowTraceOutputLine "Tubing part place parent product name = " & ParentProductTub.Name Dim ParentProductPip As Product Set ParentProductPip = FindProduct(gRootProduct, "CAAPspEduPipes.1") If (ParentProductPip Is Nothing) Then Err.Raise 9999,sDocPath,"Unable to get parent product" End If ShowTraceOutputLine "Piping part place parent product name = " & ParentProductPip.Name ... Add Parts to Hold PointsThe RouteStringPartInSpace routine needs points to define the ends and corners of any string parts it places. Points can only be created inside parts. Here the macro creates parts to hold the necessary points. A part is created under each work package. As an alternative to creating points, you can use points that are already in the model. Finding points already in the mode is not demonstrated in this macro. Note: You should create the parts under the work package that hold the string part you are placing because the RouteStringPartInSpace routine interprets the points relative to that workpackage. If the part with the points and the work package have different axis systems the string location will not match the point locations. ... ' ------------------------------------------------------------------------- ' Add parts to hold points ' Parts created under placement part parent because points are interpretted as relative to that parent. ' ------------------------------------------------------------------------- Dim PartForPointsProductTub As Product Set PartForPointsProductTub = Nothing Dim PartForPointsTub As Part Set PartForPointsTub = Nothing Dim PartForPointsGeoSetTub As OrderedGeometricalSet Set PartForPointsGeoSetTub = Nothing Dim PartForPointsProductPip As Product Set PartForPointsProductPip = Nothing Dim PartForPointsPip As Part Set PartForPointsPip = Nothing Dim PartForPointsGeoSetPip As OrderedGeometricalSet Set PartForPointsGeoSetPip = Nothing Dim PartForPointsDoc As Document Set PartForPointsProductTub = ParentProductTub.Products.AddNewComponent("Part", "PartForPointsTubing") ShowTraceOutputLine "Part for tubing points product name = " & PartForPointsProductTub.Name If (Not (PartForPointsProductTub is Nothing) ) Then Set PartForPointsDoc = PartForPointsProductTub.GetMasterShapeRepresentation(TRUE) Set PartForPointsTub = PartForPointsDoc.Part End If ShowTraceOutputLine "Part for tubing points name = " & PartForPointsTub.Name Set PartForPointsGeoSetTub = PartForPointsTub.OrderedGeometricalSets.Add If (PartForPointsTub Is Nothing Or PartForPointsGeoSetTub Is Nothing) Then Err.Raise 9999,sDocPath,"Unable to add part to hold tubing points" End If Set PartForPointsProductPip = ParentProductPip.Products.AddNewComponent("Part", "PartForPointsPiping") ShowTraceOutputLine "Part for tubing points product name = " & PartForPointsProductPip.Name If (Not (PartForPointsProductPip is Nothing) ) Then Set PartForPointsDoc = PartForPointsProductPip.GetMasterShapeRepresentation(TRUE) Set PartForPointsPip = PartForPointsDoc.Part End If ShowTraceOutputLine "Part for piping points name = " & PartForPointsPip.Name Set PartForPointsGeoSetPip = PartForPointsPip.OrderedGeometricalSets.Add If (PartForPointsPip Is Nothing Or PartForPointsGeoSetPip Is Nothing) Then Err.Raise 9999,sDocPath,"Unable to add part to hold piping points" End If ... Define Some Part Placement VariablesAs a final setup step, the macro defines several variables that will be used to send data to the RouteStringPartInSpace routine. ... '----------------------------------------------------------------------- ' Define some part placement variables '----------------------------------------------------------------------- Dim objInstancePartOfReference As Product Dim objReferencePart As Product Dim LogicalLine As PspLogicalLine Dim Standard As String Dim FunctionType As String Dim PlacedPartID As String Dim UpDirectionFirstPoint As PspListOfDoubles Set UpDirectionFirstPoint = gListFactory.CreateListOfDoubles() Dim Point As HybridShapePointCoord Dim ListPlacementPoints As PspListOfObjects Set ListPlacementPoints = gListFactory.CreateListOfObjects() Dim Location(2) Dim ListBendRadii As PspListOfDoubles Set ListBendRadii = gListFactory.CreateListOfDoubles() Dim PlacePartRef As CATIABase Dim objPlacePart As PspPlacePart Dim objPlacePartProduct As Product ... Place TubeNow enough data has been gathered to place the string parts. The placement is done by calling the RouteStringPartInSpace method on the objPlacePart object. Before RouteStringPartInSpace is called a few input argument values are set. Standard is set to specify the standard to be used in the placement. The function type to assciate with the placed part is specified by FunctionType. objReferencePart is set to the reference of the straight tube in the model, T-003. LogicalLine is set to specify the tubing line which will contain the part. PlacedPartID is used to set the ID of the string part that will be placed. If PlacedPartID is an empty string RouteStringPartInSpace will use normal part placement engine naming conventions. Three arguments are set to specify the position and length of the tube. UpDirectionFirstPoint is used to determine the up direction of the first point. For round string parts like pipes and tubes it is not usually very important. It is more useful for applications like HVAC and Raceway that have not circular parts. ListPlacementPoints is the list of points that defines the ends and corners of a string part. For straight tubes and pipes, the list should have exactly two elements. If it has more than two, the rest are ignored. When a tube or pipe with bends is placed, the first and last point in ListPlacementPoints are the ends. All other points are corners. ListBendRadii is not relevant for a straight tube or pipe. It is used for tubes and pipes with bends. Bend radii are only needed for corners of strings, not for end points. Rather than have two less elements in ListBendRadii than in ListPlacementPoints, it is simpler to keep the lists the same length. For this reason each radius in ListBendRadii corresponds to the same point in ListPlacementPoints. This means that the first and last bend radii are not used. However, if ListBendRadii has less elements than ListPlacementPoints, the last radius in ListBendRadii is used for all remaining ListPlacementPoints corners. Note: UpDirectionFirstPoint and ListPlacementPoints are both taken by RouteStringPartInSpace as relative to the work package (ParentProductTub in this example). ... '----------------------------------------------------------------------- '----------------------------------------------------------------------- ' Place Tube '----------------------------------------------------------------------- '----------------------------------------------------------------------- Set objInstancePartOfReference = GetPspPhysicalProduct(objPspApplicationPip, catPspIDLCATTUB, "T-003") Set objReferencePart = GetReferencePart(objInstancePartOfReference) Set LogicalLine = GetLogicalLine(objInstancePartOfReference) Standard = "SSTL" FunctionType = "CATTubTubeFunction" PlacedPartID = "TestTube" 'Null string uses name generated by PP engine ' Up direction for part = (0,0,1) ClearDoubles UpDirectionFirstPoint UpDirectionFirstPoint.Append 0.0 'Align vertical parallel to z-axis. UpDirectionFirstPoint.Append 0.0 UpDirectionFirstPoint.Append 1.0 ClearObjects ListPlacementPoints ' Create points Set Point = PartForPointsTub.HybridShapeFactory.AddNewPointCoord(0.0, -1000.0, 0.0) PartForPointsGeoSetTub.InsertHybridShape Point ShowPointPosition Point ListPlacementPoints.Append Point Set Point = PartForPointsTub.HybridShapeFactory.AddNewPointCoord(-1000.0, -1000.0, 0.0) PartForPointsGeoSetTub.InsertHybridShape Point ShowPointPosition Point ListPlacementPoints.Append Point ClearDoubles ListBendRadii ListBendRadii.Append 25.4 'Bend radius in mm (1in). ListBendRadii.Append 25.4 Set PlacePartRef = Nothing Set objPlacePart = Nothing Set objPlacePart = gPspWorkbench.GetInterface("CATIAPspPlacePart", objPspApplicationTub ) If ( Not ( objPlacePart Is Nothing ) ) Then Set PlacePartRef = objPlacePart.RouteStringPartInSpace(Standard, _ FunctionType, _ objReferencePart, _ ParentProductTub, _ LogicalLine, _ PlacedPartID, _ UpDirectionFirstPoint, _ ListPlacementPoints, _ ListBendRadii) End If If ( PlacePartRef Is Nothing ) Then Err.Raise 9999,sDocPath,"Place part error = " & objPlacePart.ErrorMessage Else ShowObjectID "Placed part", PlacePartRef End If ... After the tube is placed, the script tests and displays some data related to the tube using the ShowProductInfo subroutine. ... '----------------------------------------------------------------------- ' View and Test Part Data '----------------------------------------------------------------------- ' Placed part position Set objPlacePartProduct = gPspWorkbench.GetInterface("CATIAProduct", PlacePartRef ) If ( objPlacePartProduct Is Nothing ) Then Err.Raise 9999,sDocPath,"Bad placed product" End If ShowProductInfo objPlacePartProduct, "Placed part", ParentProductTub ... In the ShowProductInfo routine, first the position of the part itself is shown with the ShowProductPosition subroutine. ... ' Show product info Sub ShowProductInfo(iProduct As Product, iName As String, iRelativeAxis As Product) ShowProductPosition iProduct, iName ... Sub ShowProductPosition(iProduct As Product, iName As String) If ( Not ( iProduct Is Nothing ) ) Then Dim positArray(11) As CATSafeArray iProduct.Position.GetComponents(positArray) ShowTraceOutputLine iName & " posit = " & DumpTransform(positArray) End If End Sub ... Then data associated with the part connectors of the part is tested and displayed. ... ' Placed part connectors Dim objPlacePartPhysical As CATIAPspPhysicalProduct Set objPlacePartPhysical = Nothing Set objPlacePartPhysical = gPspWorkbench.GetInterface("CATIAPspPhysicalProduct", iProduct ) If ( Not ( objPlacePartPhysical Is Nothing ) ) Then ShowTraceOutputLine "Number of connectors = " & objPlacePartPhysical.Connectors.Count If ( objPlacePartPhysical.Connectors.Count <> 2 ) Then Err.Raise 9999,sDocPath,"Wrong number of connectors" End If Dim iiCtr As Integer For iiCtr = 1 to objPlacePartPhysical.Connectors.Count ShowTraceOutputLine "iiCtr = " & iiCtr Dim Ctr As PspPartConnector Set Ctr = objPlacePartPhysical.Connectors.Item(iiCtr, "CATIAPspPartConnector") If ( Ctr Is Nothing ) Then Err.Raise 9999,sDocPath,"Bad connector" End If ShowTraceOutputLine "Ctr name = " & Ctr.Name Dim CtrPosit As PspListOfDoubles Set CtrPosit = Nothing Set CtrPosit = Ctr.GetPosition(iRelativeAxis) ShowTraceOutputLine "Ctr posit = " & DumpVector(CtrPosit) Dim CtrAlign As PspListOfDoubles Set CtrAlign = Nothing Set CtrAlign = Ctr.GetAlignmentDirection(iRelativeAxis) ShowTraceOutputLine "Ctr align = " & DumpVector(CtrAlign) Dim CtrUp As PspListOfDoubles Set CtrUp = Nothing Set CtrUp = Ctr.GetUpDirection(iRelativeAxis) ShowTraceOutputLine "Ctr up = " & DumpVector(CtrUp) Next End If End Sub ... Place Tube with BendsThe three remaining calls to RouteStringPartInSpace are very similar to the first. Only the differences will be highlighted. For the tube with bends the reference is the reference of the existing tube with bends, T-004. ListPlacementPoints and ListBendRadii now have four elements each to produce a tube with two ends and two corners. ... '----------------------------------------------------------------------- '----------------------------------------------------------------------- ' Place Tube with bends '----------------------------------------------------------------------- '----------------------------------------------------------------------- Set objInstancePartOfReference = GetPspPhysicalProduct(objPspApplicationPip, catPspIDLCATTUB, "T-004") Set objReferencePart = GetReferencePart(objInstancePartOfReference) Set LogicalLine = GetLogicalLine(objInstancePartOfReference) Standard = "SSTL" FunctionType = "CATTubTubeFunction" PlacedPartID = "TestTubeWithBends" 'Null string uses name generated by PP engine ' Up direction for part = (0,0,1) ClearDoubles UpDirectionFirstPoint UpDirectionFirstPoint.Append 0.0 'Align vertical parallel to z-axis. UpDirectionFirstPoint.Append 0.0 UpDirectionFirstPoint.Append 1.0 ClearObjects ListPlacementPoints ' Create points Set Point = PartForPointsTub.HybridShapeFactory.AddNewPointCoord(-1500.0, -1000.0, 0.0) PartForPointsGeoSetTub.InsertHybridShape Point ShowPointPosition Point ListPlacementPoints.Append Point Set Point = PartForPointsTub.HybridShapeFactory.AddNewPointCoord(-2500.0, -1000.0, 0.0) PartForPointsGeoSetTub.InsertHybridShape Point ShowPointPosition Point ListPlacementPoints.Append Point Set Point = PartForPointsTub.HybridShapeFactory.AddNewPointCoord(-2500.0, 500.0, 0.0) PartForPointsGeoSetTub.InsertHybridShape Point ShowPointPosition Point ListPlacementPoints.Append Point Set Point = PartForPointsTub.HybridShapeFactory.AddNewPointCoord(-3500.0, 500.0, 0.0) PartForPointsGeoSetTub.InsertHybridShape Point ShowPointPosition Point ListPlacementPoints.Append Point ClearDoubles ListBendRadii ListBendRadii.Append 25.4 'Bend radius in mm (1in). ListBendRadii.Append 25.4 ListBendRadii.Append 25.4 ListBendRadii.Append 25.4 Set PlacePartRef = Nothing Set objPlacePart = Nothing Set objPlacePart = gPspWorkbench.GetInterface("CATIAPspPlacePart", objPspApplicationTub ) If ( Not ( objPlacePart Is Nothing ) ) Then Set PlacePartRef = objPlacePart.RouteStringPartInSpace(Standard, _ FunctionType, _ objReferencePart, _ ParentProductTub, _ LogicalLine, _ PlacedPartID, _ UpDirectionFirstPoint, _ ListPlacementPoints, _ ListBendRadii) End If If ( PlacePartRef Is Nothing ) Then Err.Raise 9999,sDocPath,"Place part error = " & objPlacePart.ErrorMessage Else ShowObjectID "Placed part", PlacePartRef End If '----------------------------------------------------------------------- ' View and Test Part Data '----------------------------------------------------------------------- ' Placed part position 'Set objPlacePartProduct = PlacePartRef Set objPlacePartProduct = gPspWorkbench.GetInterface("CATIAProduct", PlacePartRef ) If ( objPlacePartProduct Is Nothing ) Then Err.Raise 9999,sDocPath,"Bad placed product" End If ShowProductInfo objPlacePartProduct, "Placed part", ParentProductTub ... Place PipeNow that a pipe is being placed, the application must change. Thus objPlacePart is derived from the piping application object, objPspApplicationPip. The piping parent, ParentProductPip, is used as the work package. Standard and FunctionType are set to piping appropriate values. The reference for the pipe objReferencePart is the reference of the straight pipe, P-052. ListPlacementPoints and ListBendRadii have two elements, just as the straight tube did. ... '----------------------------------------------------------------------- '----------------------------------------------------------------------- ' Place Pipe '----------------------------------------------------------------------- '----------------------------------------------------------------------- Set objInstancePartOfReference = GetPspPhysicalProduct(objPspApplicationPip, catPspIDLCATPIP, "P-052") Set objReferencePart = GetReferencePart(objInstancePartOfReference) Set LogicalLine = GetLogicalLine(objInstancePartOfReference) Standard = "ASTL" FunctionType = "CATPspPipeFunction" PlacedPartID = "TestPipe" 'Null string uses name generated by PP engine ' Up direction for part = (0,0,1) ClearDoubles UpDirectionFirstPoint UpDirectionFirstPoint.Append 0.0 'Align vertical parallel to z-axis. UpDirectionFirstPoint.Append 0.0 UpDirectionFirstPoint.Append 1.0 ClearObjects ListPlacementPoints ' Create points Set Point = PartForPointsPip.HybridShapeFactory.AddNewPointCoord(0.0, 1000.0, 0.0) PartForPointsGeoSetPip.InsertHybridShape Point ShowPointPosition Point ListPlacementPoints.Append Point Set Point = PartForPointsPip.HybridShapeFactory.AddNewPointCoord(0.0, 2000.0, 0.0) PartForPointsGeoSetPip.InsertHybridShape Point ShowPointPosition Point ListPlacementPoints.Append Point ClearDoubles ListBendRadii ListBendRadii.Append 50.8 'Bend radius in mm (2in). ListBendRadii.Append 50.8 Set PlacePartRef = Nothing Set objPlacePart = Nothing Set objPlacePart = gPspWorkbench.GetInterface("CATIAPspPlacePart", objPspApplicationPip ) If ( Not ( objPlacePart Is Nothing ) ) Then Set PlacePartRef = objPlacePart.RouteStringPartInSpace(Standard, _ FunctionType, _ objReferencePart, _ ParentProductPip, _ LogicalLine, _ PlacedPartID, _ UpDirectionFirstPoint, _ ListPlacementPoints, _ ListBendRadii) End If If ( PlacePartRef Is Nothing ) Then Err.Raise 9999,sDocPath,"Place part error = " & objPlacePart.ErrorMessage Else ShowObjectID "Placed part", PlacePartRef End If '----------------------------------------------------------------------- ' View and Test Part Data '----------------------------------------------------------------------- ' Placed part position 'Set objPlacePartProduct = PlacePartRef Set objPlacePartProduct = gPspWorkbench.GetInterface("CATIAProduct", PlacePartRef ) If ( objPlacePartProduct Is Nothing ) Then Err.Raise 9999,sDocPath,"Bad placed product" End If ShowProductInfo objPlacePartProduct, "Placed part", ParentProductPip ... Place Pipe with BendsFor the pipe with bends the reference is the reference of the existing pipe with bends, P-053. ListPlacementPoints and ListBendRadii have four elements each to produce a pipe with two ends and two corners. ... '----------------------------------------------------------------------- '----------------------------------------------------------------------- ' Place Pipe with bends '----------------------------------------------------------------------- '----------------------------------------------------------------------- Set objInstancePartOfReference = GetPspPhysicalProduct(objPspApplicationPip, catPspIDLCATPIP, "P-053") Set objReferencePart = GetReferencePart(objInstancePartOfReference) Set LogicalLine = GetLogicalLine(objInstancePartOfReference) Standard = "ASTL" FunctionType = "CATPspPipeFunction" PlacedPartID = "TestPipeWithBends" 'Null string uses name generated by PP engine ' Up direction for part = (0,0,1) ClearDoubles UpDirectionFirstPoint UpDirectionFirstPoint.Append 0.0 'Align vertical parallel to z-axis. UpDirectionFirstPoint.Append 0.0 UpDirectionFirstPoint.Append 1.0 ClearObjects ListPlacementPoints ' Create points Set Point = PartForPointsPip.HybridShapeFactory.AddNewPointCoord(1000.0, 1000.0, 0.0) PartForPointsGeoSetPip.InsertHybridShape Point ShowPointPosition Point ListPlacementPoints.Append Point Set Point = PartForPointsPip.HybridShapeFactory.AddNewPointCoord(1000.0, 2000.0, 0.0) PartForPointsGeoSetPip.InsertHybridShape Point ShowPointPosition Point ListPlacementPoints.Append Point Set Point = PartForPointsPip.HybridShapeFactory.AddNewPointCoord(2500.0, 2000.0, 0.0) PartForPointsGeoSetPip.InsertHybridShape Point ShowPointPosition Point ListPlacementPoints.Append Point Set Point = PartForPointsPip.HybridShapeFactory.AddNewPointCoord(2500.0, 1000.0, 0.0) PartForPointsGeoSetPip.InsertHybridShape Point ShowPointPosition Point ListPlacementPoints.Append Point ClearDoubles ListBendRadii ListBendRadii.Append 50.8 'Bend radius in mm (2in). ListBendRadii.Append 50.8 ListBendRadii.Append 50.8 ListBendRadii.Append 50.8 Set PlacePartRef = Nothing Set objPlacePart = Nothing Set objPlacePart = gPspWorkbench.GetInterface("CATIAPspPlacePart", objPspApplicationPip ) If ( Not ( objPlacePart Is Nothing ) ) Then Set PlacePartRef = objPlacePart.RouteStringPartInSpace(Standard, _ FunctionType, _ objReferencePart, _ ParentProductPip, _ LogicalLine, _ PlacedPartID, _ UpDirectionFirstPoint, _ ListPlacementPoints, _ ListBendRadii) End If If ( PlacePartRef Is Nothing ) Then Err.Raise 9999,sDocPath,"Place part error = " & objPlacePart.ErrorMessage Else ShowObjectID "Placed part", PlacePartRef End If '----------------------------------------------------------------------- ' View and Test Part Data '----------------------------------------------------------------------- ' Placed part position 'Set objPlacePartProduct = PlacePartRef Set objPlacePartProduct = gPspWorkbench.GetInterface("CATIAProduct", PlacePartRef ) If ( objPlacePartProduct Is Nothing ) Then Err.Raise 9999,sDocPath,"Bad placed product" End If ShowProductInfo objPlacePartProduct, "Placed part", ParentProductPip ... Clean up ModelAfter all the parts are placed, the script cleans up the model. The cleaning consists of deleting the part that holds the points. This is done to leave the model in the same state it was found, except for the placed parts. This cleaning is not necessary: if you want to keep the parts and points in them that is OK also. After deleting the parts, the script dumps all messages. When run interactively this dumps the messages to an information panel. ... '----------------------------------------------------------------------- ' Clean up model '----------------------------------------------------------------------- ' Remove part that holds points If (Not (PartForPointsProductTub is Nothing) ) Then ParentProductTub.Products.Remove(PartForPointsProductTub.Name) End If If (Not (PartForPointsProductPip is Nothing) ) Then ParentProductPip.Products.Remove(PartForPointsProductPip.Name) End If ' Dump messages. DumpTraces ... |
[Top]
This use case is intended to show you how to place string parts. It places a straight tube, a tube with bends, a straight light pipe and a light pipe with bends. It shows how to load a model and setup the environment, how to gather necessary data and how to place string parts. It also illustrates how to extract some data from the placed parts.
Here is what the input model looks like.
Here is the model after the tubes and pipes are placed.
Here are the status messages displayed at the end of the macro execution.
[Top]
[1] | Replaying a macro |
[Top] |
Copyright © 2004, Dassault Systèmes. All rights reserved.