Dim comp as DrawingComponent
Set comp = CATIA.ActiveDocument Selection.Item(1).Value
Dim refView as DrawingView
Set refView = comp.CompRef
Dim refSheet as DrawingSheet
Set refSheet = refView.Parent.Parent
Dim refDoc as DrawingDocument
Set refDoc = refSheet.Parent.Parent
Debug.Print...
A common approach to do it with VBA:
1. Enable color inheritance for drawing views
2. Color the part uniquely
3. Update views
4. Use Selection.Search to find generated geometry of the color chosen in step 2.
In C++ you do it by retrieving CATIDftGenRequest from view that yields a set of...
Your titleblock text that displays scale should be linked with `Scale` parameter with attribute link.
set sheet = CATIA.ActiveDocument.Sheets.ActiveSheet
for each param in CATIA.ActiveDocument.Parameters.SubList(sheet, True)
if InStrRev(param.Name, "ViewMakeUp.1\Scale") > 0 then
set...
CATIDescendants::ChangePosition works fine with features inside CATPart, but not with products inside CATProduct.
There's a specific interface for reordering products, unfortunately it's not a part of CAA client's installation.
Another option is to automate reodering via "Reorder Tree" command...
I'm going to elaborate on what I meant:
1. Write macro that would search for parts in currently opened assembly and copy them them to a temporary assembly.
2. Run that macro, close your original assembly.
3. Activate temporary assembly, run Desk command.
4. Select ALL parts and run CATDUA.
5...
AFAIR Desk relationship tree is displayed relative from active document. So if you search for part in original assembly, open it in new window and run Desk command from there it should be easy to find this part as it is going to be located in the very left part of relationship tree.
Similar...
Use LWolf's solution as it enumerates "opened" documents meaning the ones that have their own window.
Although I'd adjusted "if" condition, because right now it matches ANY documents that have word "Drawing" in them (i.e. "AssemblyForDrawing.CATProduct")
Sub CATMain()
Dim win, doc...