Selecting objects in MDT4

Selecting objects in MDT4

Anonymous
Not applicable
127 Views
2 Replies
Message 1 of 3

Selecting objects in MDT4

Anonymous
Not applicable
Is there a way to select a object in Mechanical Desktop
by using the browser name?

--
Living in their pools they soon forget about the sea.
(RUSH)
0 Likes
128 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Hi Steve,

Assuming you are looking for a part name and not a feature name, I hope this
will help.

Dim oMCADApp As McadApplication
Set oMCADApp =
ThisDrawing.Application.GetInterfaceObject("MCAD.Application")

Dim oAllParts As McadComponentDefinitions
Dim oSinglePart As McadComponentDefinition

Dim oAssyMgr As McadAssemblyMgr
Set oAssyMgr = oMCADApp.ActiveDocument.AssemblyMgr

Dim oRootDef As McadComponentDefinition
Set oRootDef = oAssyMgr.RootDefinition

Dim oComponent As McadComponent

Dim sPartName As String
sPartName = ThisDrawing.Utility.GetString(True, "Enter part name: ")

For Each oComponent In oRootDef.Children
If oComponent.Name = sPartName Then oComponent.Highlight True
Debug.Print oComponent.Name
Next

MsgBox "Done"

Regards,

Gary
0 Likes
Message 3 of 3

Anonymous
Not applicable
Remember that the ComponentDefinition name and the name displayed in the
Assembly browser may not be the same. Invoke AMCATALOG for a list of
component definition names.

Thilak

Gary McMaster wrote in message
news:ef07217.0@WebX.SaUCah8kaAW...
> Hi Steve,
>
> Assuming you are looking for a part name and not a feature name, I hope
this
> will help.
>
> Dim oMCADApp As McadApplication
> Set oMCADApp =
> ThisDrawing.Application.GetInterfaceObject("MCAD.Application")
>
> Dim oAllParts As McadComponentDefinitions
> Dim oSinglePart As McadComponentDefinition
>
> Dim oAssyMgr As McadAssemblyMgr
> Set oAssyMgr = oMCADApp.ActiveDocument.AssemblyMgr
>
> Dim oRootDef As McadComponentDefinition
> Set oRootDef = oAssyMgr.RootDefinition
>
> Dim oComponent As McadComponent
>
> Dim sPartName As String
> sPartName = ThisDrawing.Utility.GetString(True, "Enter part name: ")
>
> For Each oComponent In oRootDef.Children
> If oComponent.Name = sPartName Then oComponent.Highlight True
> Debug.Print oComponent.Name
> Next
>
> MsgBox "Done"
>
> Regards,
>
> Gary
>
0 Likes