Create a positional link to a DrawingComponent in macro
Create a positional link to a DrawingComponent in macro
(OP)
Hi,
I cannot create a positional link to a DrawingComponent (2D ditto, lets say a cross), by picking that ditto, to a text, in macro.
I've tried something like this:
Dim oSelection
oSelection = DrawDoc1.Selection
Dim oInputType(0)
Dim oStatus
oInputType(0) = "DrawingComponent"
oStatus = oSelection.SelectElement2(oInputType, "Select a 2D Component", True)
If (oStatus = "Cancel") Then
Exit Sub
End If
Dim Myselection As Selection
Myselection = CATIA.ActiveDocument.Selection
DrawText1.AssociativeElement = Myselection
Does anyone found a solution for this?
I cannot create a positional link to a DrawingComponent (2D ditto, lets say a cross), by picking that ditto, to a text, in macro.
I've tried something like this:
Dim oSelection
oSelection = DrawDoc1.Selection
Dim oInputType(0)
Dim oStatus
oInputType(0) = "DrawingComponent"
oStatus = oSelection.SelectElement2(oInputType, "Select a 2D Component", True)
If (oStatus = "Cancel") Then
Exit Sub
End If
Dim Myselection As Selection
Myselection = CATIA.ActiveDocument.Selection
DrawText1.AssociativeElement = Myselection
Does anyone found a solution for this?
Regards
Fernando
https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...





RE: Create a positional link to a DrawingComponent in macro
but i do it for another geometry...
CODE -->
Sub Positional_Link() Dim oDocument 'As Document Set oDocument = CATIA.ActiveDocument Dim oDrawingDocument 'As DrawingDocument Set oDrawingDocument = oDocument Dim oSelection 'As Selection Set oSelection = oDrawingDocument.Selection Dim oSheets 'As DrawingSheets Set oSheets = oDrawingDocument.Sheets Dim oSheet 'As DrawingSheet Set oSheet = oSheets.Item(1) Dim oView 'As DrawingView Set oView = oSheet.Views.ActiveView Dim InputObjectType(0) Dim oStatus InputObjectType(0) = "DrawingText" oStatus = oSelection.SelectElement2(InputObjectType, "Select Text", True) If (oStatus = "Cancel") Then Exit Sub End If Set SelectedElement = oSelection.Item(1) Set Text = SelectedElement.Value oSelection.Clear ReDim oInputType(1): oInputType(0) = "Line2D": oInputType(1) = "DrawingComponent" oStatus = oSelection.SelectElement2(oInputType, "Select a 2D Component Or Line", True) If (oStatus = "Cancel") Then Exit Sub End If Dim oSelection1 'As Selection Set oSelection1 = oDrawingDocument.Selection Set Selected = oSelection1.Item(1) Set Ditto = Selected.Value Dim o2DComponents 'As DrawingComponents Set o2DComponents = oView.Components Dim o2DComponent 'As DrawingComponent 'Set o2DComponent = o2DComponents.Item(Ditto.Name) Text.AssociativeElement = Ditto ' o2DComponent End SubRE: Create a positional link to a DrawingComponent in macro
It seems the method AssociativeElement works for interactively created geometry but fails for generated geometry...what a pity...no way for positional link for dittos...
Regards
Fernando
https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...