×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Create a positional link to a DrawingComponent in macro
2

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?

Regards
Fernando

https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...

RE: Create a positional link to a DrawingComponent in macro

2
I can't do it with a ditto...
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 Sub 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources