Quantcast
Channel: Manufacturing DevBlog
Viewing all articles
Browse latest Browse all 518

Select plane of given part occurrence

$
0
0

By Adam Nagy

If you want to select one of the planes of a component occurrence inside an assembly, then you first have to get the component definition of that occurrence in order to get to its work planes. Then you need to get the work plane's representaion (proxy) inside the assembly through the component occurrence object:
http://adndevblog.typepad.com/manufacturing/2013/07/occurrences-contexts-definitions-proxies.html

In this case we select the XY plane of the currently selected part component occurrence:

Sub SelectXyPlaneOfOccurrence()
    Dim doc As AssemblyDocument
    Set doc = ThisApplication.ActiveDocument' Let's say the occurrence is already' selected in the UI
    Dim occ As ComponentOccurrence
    Set occ = doc.SelectSet(1)' Let's select the XY plane (3rd in the list)
    Dim pcd As PartComponentDefinition
    Set pcd = occ.Definition
    Dim wp As WorkPlane
    Set wp = pcd.WorkPlanes(3)' Get its representation in the' assembly
    Dim wpp As WorkPlaneProxy
    Call occ.CreateGeometryProxy(wp, wpp)' Now select it
    Call doc.SelectSet.Select(wpp)
End Sub

Planeselection

 


Viewing all articles
Browse latest Browse all 518

Trending Articles