Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

Changing ipart member in a drawing

J.Oye
Advocate

Changing ipart member in a drawing

J.Oye
Advocate
Advocate

I would like to know If an ilogic rule can be written that would do the same thing as If one was to go into the base view settings in a drawing and change out the ipart member that is being used within the drawing?  screencast video is attached.

0 Likes
Reply
Accepted solutions (1)
876 Views
7 Replies
Replies (7)

clutsa
Collaborator
Collaborator
Sub ChangeiFactoryViewMember()
    Dim app As Application
    Dim IDW As DrawingDocument

    Set app = ThisApplication
    Set IDW = app.ActiveDocument
    Dim DV As DrawingView
    Set DV = IDW.ActiveSheet.DrawingViews(1)
    DV.ActiveMemberName = "iPartTest-02"
    

End Sub

You'll want to add error trapping and some code to figure out what member you want to change to but it's fairly straight forward. 

 

Edit: Sorry just realized I posted VBA code not iLogic. I'll do a new one for iLogic... just a minute.

If I've helped you, please help me by supporting this idea.
Mass Override for Each Model State

Custom Glyph Icon for iMates

clutsa
Collaborator
Collaborator
Accepted solution
Dim DV As DrawingView = ActiveSheet.View("VIEW1").View
DV.ActiveMemberName = "iPartTest-03"

Turns out it's even easier in iLogic.

If I've helped you, please help me by supporting this idea.
Mass Override for Each Model State

Custom Glyph Icon for iMates

Sergio.D.Suárez
Mentor
Mentor

 

Dim oDoc As Document = ThisDoc.Document
Dim osheet As Sheet = oDoc.Activesheet
Dim oView As DrawingView = osheet.DrawingViews(1)

Dim RefDoc As Document = oView.ReferencedDocumentDescriptor.ReferencedDocument

Dim OriginDoc As Document=  RefDoc.ReferencedDocuments(1)
 
Dim oFactory As iPartFactory = OriginDoc.ComponentDefinition.iPartFactory
		
Dim oMemberList As New ArrayList

For i As Integer = 1 To OriginDoc.componentdefinition.iPartFactory.TableRows.Count
	oMember = OriginDoc.componentdefinition.iPartFactory.TableRows.Item(i).MemberName
	oMemberList.Add(oMember)
Next

Dim oValue As String = InputListBox("Select Member", oMemberList, oMemberList(0), "Ilogic", "Available Members")
If oValue = "" Then Exit Sub

On Error Resume Next
oView.ActiveMemberName = oValue

 Hi, Here I share an ilogic code. It seemed to be a simple task but the truth gave me headaches.
Try to generate a list box with the contents of the ranks of ipart members. To achieve this, I had to take the reference document and here there was a problem, open the derivative document, the one that does not have the table, then it is necessary to refer again to the document of origin of the ipart. Then all the members of ipart must be generated and saved, because if they are not saved, they will not be able to change the reference in the view.
I hope I have been clear and that the code is useful for you. regards


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn

0 Likes

J.Oye
Advocate
Advocate

Much appreciated clutsa, code worked out great!

0 Likes

Anonymous
Not applicable

I want auto-update ipart view, placed in idw, as ipart changes its configuration & lengths,
with your solution I am Unable to get desired output as of now, Kindly tell me how to use this Programme or other logic program?

0 Likes

ulasdeniz
Mentor
Mentor

Hi. What about if I use İassembly rather than ipart in the drawing? I would appraciate if you help me. Thanks.


Ulaş Deniz


Forumlarımızda çözülen sorularınızı "ÇÖZÜM OLARAK KABUL ET" ( "ACCEPT AS SOLUTION" ) seçimiyle işaretlemeyi lütfen unutmayın.
Beğendiğiniz mesajları lütfen "Övgü Puanı" (KUDO) ile ödüllendirin.
Youtube : https://www.youtube.com/channel/UCkJpVueGScmJvW1RIgqttSg

0 Likes

A.Acheson
Mentor
Mentor

Here is a post working with iassemblies on a drawing.

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes