Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Alternate Assemblies

Status
Not open for further replies.

snowie

Agricultural
Mar 16, 2005
8
Howdy
Via code how do you tell what family member is currently active in a assembly.

ObjDoc.AssemblyFamilyMembers.??????

Cheers
Snow
 
Replies continue below

Recommended for you

Hi,

below find a code snippet to get the member name from an occurrence

HTH

dy

============

Dim objOcc As Occurrence
Dim objOccDoc As Object
Dim sFilename As String
Dim sMemberName As String
Dim sNameNoMember As String
Dim i As Long

Set objOcc = objAsm.Occurrences.Item(1) ' just for test
Set objOccDoc = objOcc.OccurrenceDocument
sFilename = Trim(objOcc.OccurrenceDocument.FullName) ' filepath with possible member
sNameNoMember = sFilename
sMemberName = vbNullString
'
If objOcc.Subassembly Then
If objOcc.OccurrenceDocument.IsFileAlternatePositionByDocument Or _
objOcc.OccurrenceDocument.IsFileFamilyByDocument Then
i = InStrRev(sFilename, "!", -1, vbTextCompare)
If i > 0 Then
sMemberName = Mid(sFilename, i + 1) ' isolate member
sNameNoMember = Left(sFilename, i - 1) ' filepath without member
End If
End If
End If
==============
 
Thanks
Will try that
Snow
 
Sorry I didn't explane well
The current assembly document IS a Family Of Parts or has Alternate Position in it. ie ball valve open/closed positions.

How do you get the current active member position name? or Family Part Name

Thanks Don Young your code works for a assembly

Cheers
Snow


 
Hi,

for the top level asssembly do the check on the file's name
(objAsm.Name) instead

dy
 
Hi Don
Tried that and the result is
AssyName.asm!Master 'not the current active FamilyMembers Name

I thought is would be somthing like
Debug.Print ObjDoc.AssemblyFamilyMembers.Name 'witch doesn't work

But
Debug.Print ObjDoc.AssemblyFamilyMembers.Count 'gets the number of FamilyMembers in the top level assembly

Also
Debug.Print ObjDoc.AssemblyFamilyMembers(1).MemberName 'get's the name of the first member (which i'm after)

but i still can't get the name of the current active members name or the current active member index number

nearly forgot.I' using V15

Cheers
Snow







 
Hi,

hmm, what would you like to achive then? When the master is opened
it will IMHO always show that member that was first defined (that's
the original assembly). This one BTW can't be deleted and thus always
has an index of 1.
To get a different one displayed just activate it.

dy
 
Hi Don
What i'm doing is i have written a few macro's that automatically fill out the custom prop's. One on them fills out the part name witch is the active part name (Less the file path). But when it go's to do a family member assy it fill it out incorrectly and sticks .asm!master in the part name. What i wanted to do is to fill out the part name with the member name in it as well eg '1/2 ballvalve (Closed)' or 'Main Chassis (Electric Drive)' Automatically from the active member but I can't get the active FamilyMembers Name

This make sence?
Cheers Snow
 
Hi,

yes, that makes sense but AFAIK you can't do that on an FOA that easy
way.
An FOA is just an assembly which contains some 'configurations' so to
speak as opposed to FOP where you have individual physical members which
are part copies from the master.
The only properties available direct on an FOA member are:

- seAssemblyFamilyMemberPropertyDocumentNumber
- ~ProjectName
- ~RevisionNumber

these can be accessed through the method ...\SetMemberProperties(..)

What should work is to activate the member and then you have access to the
file properties:

Call objAsm.AssemblyFamilyMembers.ActivateMember("Member2")
' apply edits to individual only
objAsm.AssemblyFamilyMembers.GlobalEditMode = False
' add if not found otherwiese update
objAsm.Properties.Item("Custom")("MyVal").Value = "8888"

I'm not sure if it will work on SE V15.

dy
 
Hi Don
Call objAsm.AssemblyFamilyMembers.ActivateMember("Member2")

You still need to know the "Member2" name before you can call it. This is the issue i have now, which is to get the currently active members name so i can push it in to the Assemblies file prop's Custom Part name field.

Cheers
Snow

 
Hi,

I know of no method to get the member name as seen in
the EdgeBar when the FOA master is open. You have to
loop over all members to pick up the individual name
and activate that.

dy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor