Schematics Platform Modeler |
Inserting a Schematic Component into a Schematic Route |
![]() |
This macro shows you how to insert a
Schematic component into a Schematic route.
The word "insert" refers to a process by which a Schematic route is split at a specific location (creating a new route) and a Schematic component is connected to the two routes, creating two connections. These connections are created through two connectors of the schematic component. These two connectors must be internally connected to each other by an "internal flow" object, which is aggregated by the Schematic component. This macro opens two documents: CAASCH_Sample.catalog and CAASCH_RouteForPlacement.CATProduct. Notice the x-y coordinates of a point (80,50), as indicated in the screen shots. They will be used later in this use case.
In this use case, two Schematic components are inserted into route using two different approaches. |
|||||||
![]() |
CAASchInsertComponent is launched in
CATIA [1]. No open document is needed. Special environment must be available to successfully run this macro:
CAASchInsertComponent.CATScript is located in the CAAScdSchUseCases module. Execute macro (Windows only). |
|||||||
![]() |
CAASchInsertComponent includes the
following steps:
PrologThe macro first loads two documents. CAASCH_Sample.catalog and CAASCH_RouteForPlacement.CATProduct.
Next, the macro acquires the schematic root object from the document. The schematic root is the top node of the object instance tree in a schematic document.
The SchematicRoot interface provides a method to retrieve the graphical representation of a reference component from the catalog by name. This graphical representation is associated to a reference component in the catalog.
Get the Schematic reference component from the catalogGiven the graphical representation (symbol) from the previous step, the macro calls GetSchObjOwner to get the Schematic reference component that the symbol is associated with.
Through the GetInterface method, the macro obtains a handle on the SchComponent interface, which is needed for creating an instance of the Schematic reference component from the catalog.
Insert an instance of the Schematic reference component - approach 1The "insert" process includes the following.
Approach 1 is specially designed for client application that has dedicated graphical user interface to manage the checking of the compatibility between the route and the component. In particular, the QueryConnectAbility and the IsTargetOKForInsert methods can be used to filter out incompatible component-route combinations (perhaps accompanied with client specific visual user feedbacks). Furthermore, when the route is being selected and the "mouse" is traveling along the route path and right before the left-mouse button clicking to define the placement location, the GetBestFitInsertInfo method can be used to make sure that the compatible component will "fit" into the route..
Insert an instance of the Schematic reference component - approach 2An client application which doesn't want to deal with the details of the compatibility checking should use approach 2. By calling the PlaceOnObject method, a Schematic component can be inserted into a route. All the compatibility methods are implicitly called in the implementation of the PlaceOnObject method and are kept transparent to the application. There are only two required input: the placement location and the object to be connected to the new instance.
To figure out the placement location of the component instance, the macro calls the private FindPlacementPoint function. There, the x-y coordinates of the route path defining points are retrieved using the GetPath method of the SchGRRRoute interface. Given these, the macro takes the mid point of the first two points in the path and returns its x-y coordinates to be the placement location.
|
[Top]
This use case shows two ways to insert a Schematic object into a Schematic route. A message logging the status of the critical steps is displayed at the end of the use case.
[Top]
[1] | Replaying a Macro |
[Top] |
Copyright © 2001, Dassault Systèmes. All rights reserved.