×
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

Alternate Assemblies

Alternate Assemblies

Alternate Assemblies

(OP)
Howdy
Via code how do you tell what family member is currently active in a assembly.

ObjDoc.AssemblyFamilyMembers.??????

Cheers
Snow
 

RE: Alternate Assemblies

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
==============

RE: Alternate Assemblies

(OP)
Thanks
Will try that
Snow

RE: Alternate Assemblies

(OP)
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


 

RE: Alternate Assemblies

Hi,

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

dy
 

RE: Alternate Assemblies

(OP)
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







 

RE: Alternate Assemblies

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

RE: Alternate Assemblies

(OP)
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

RE: Alternate Assemblies

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

RE: Alternate Assemblies

(OP)
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

 

RE: Alternate Assemblies

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
 

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