Multiple view Representation and positional Representations

Multiple view Representation and positional Representations

k14348
Advocate Advocate
631 Views
5 Replies
Message 1 of 6

Multiple view Representation and positional Representations

k14348
Advocate
Advocate

Hi,

  I want to create 6 Nos. of view Representation and 6 Nos. of Positional Representation via Vba in Assembly file. Please find the attached file for reference. Can anybody help?

 

-karthikeyan M

0 Likes
Accepted solutions (1)
632 Views
5 Replies
Replies (5)
Message 2 of 6

k14348
Advocate
Advocate
Public Sub ViewRep()

If ThisApplication.ActiveDocumentType <> kAssemblyDocumentObject Then
MsgBox "An Assembly Mustbe Active"
End
End If
Dim oAsmDoc As AssemblyDocument
Set oAsmDoc = ThisApplication.ActiveDocument

Dim oCompDef As RepresentationsManager
Set oCompDef = oAsmDoc.ComponentDefinition.RepresentationsManager

Dim oDesignViewRep As DesignViewRepresentations
Set oDesignViewRep = oCompDef.DesignViewRepresentations.Add("Stub 100")

Set oDesignViewRep = oCompDef.DesignViewRepresentations.Add("Stub 200")
Set oDesignViewRep = oCompDef.DesignViewRepresentations.Add("Stub 300")
Set oDesignViewRep = oCompDef.DesignViewRepresentations.Add("Stub 400")
Set oDesignViewRep = oCompDef.DesignViewRepresentations.Add("Stub 500")
Set oDesignViewRep = oCompDef.DesignViewRepresentations.Add("Main Bom Stub 600")

End Sub

I tried something but it showing error. Can anybody help with this issue.

-karthikeyan M

0 Likes
Message 3 of 6

bshbsh
Collaborator
Collaborator

my guess is this line

Dim oDesignViewRep As DesignViewRepresentations

should be like this:

Dim oDesignViewRep As DesignViewRepresentation

(without the last "s")

0 Likes
Message 4 of 6

k14348
Advocate
Advocate
Public Sub ViewRep()

If ThisApplication.ActiveDocumentType <> kAssemblyDocumentObject Then
MsgBox "An Assembly Mustbe Active"
End
End If
Dim oAsmDoc As AssemblyDocument
Set oAsmDoc = ThisApplication.ActiveDocument

Dim oCompDef As RepresentationsManager
Set oCompDef = oAsmDoc.ComponentDefinition.RepresentationsManager

Dim oDesignViewRep As DesignViewRepresentation
Set oDesignViewRep = oCompDef.DesignViewRepresentations.Add("Stub 100")
    oDesignViewRep = oCompDef.DesignViewRepresentations.Add("Stub 200")
    oDesignViewRep = oCompDef.DesignViewRepresentation.Add("Stub 300")
    oDesignViewRep = oCompDef.DesignViewRepresentation.Add("Stub 400")
    oDesignViewRep = oCompDef.DesignViewRepresentation.Add("Stub 500")
    oDesignViewRep = oCompDef.DesignViewRepresentation.Add("Main Bom Stub 600")

End Sub

Not working 😞

0 Likes
Message 5 of 6

bshbsh
Collaborator
Collaborator
Accepted solution
it would have worked if you hadn't f* up the rest of the code...

@k14348 wrote:
Public Sub ViewRep()

If ThisApplication.ActiveDocumentType <> kAssemblyDocumentObject Then
MsgBox "An Assembly Mustbe Active"
End
End If
Dim oAsmDoc As AssemblyDocument
Set oAsmDoc = ThisApplication.ActiveDocument

Dim oCompDef As RepresentationsManager
Set oCompDef = oAsmDoc.ComponentDefinition.RepresentationsManager

Dim oDesignViewRep As DesignViewRepresentation
Set oDesignViewRep = oCompDef.DesignViewRepresentations.Add("Stub 100")
Set oDesignViewRep = oCompDef.DesignViewRepresentations.Add("Stub 200")
Set oDesignViewRep = oCompDef.DesignViewRepresentations.Add("Stub 300")
Set oDesignViewRep = oCompDef.DesignViewRepresentations.Add("Stub 400")
Set oDesignViewRep = oCompDef.DesignViewRepresentations.Add("Stub 500")
Set oDesignViewRep = oCompDef.DesignViewRepresentations.Add("Main Bom Stub 600")

End Sub

Not working 😞


Message 6 of 6

k14348
Advocate
Advocate

Thank u its working

 

0 Likes