Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

[iLogic] Differentiating between two views with the same view identifier

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
Anonymous
488 Views, 3 Replies

[iLogic] Differentiating between two views with the same view identifier

Hello all,

 

Ran into a problem, which I can work around but its not an ideal solution. 

 

The Problem

I have two section views on my drawing, both have the view identifier 'A'. However they are sections from different base views of the same part. So 'View1' on my drawing is sectioned to give the first 'A' view. Then i have 'View2' (which shows the same thing as 'View1') and is sectioned to give the second 'A' view. When the part being sectioned increases past a certain size I want to hide the first 'A' view and then leave the other 'A' view showing. And vica versa when the part decreases in length, using iLogic to do this in both cases. 

 

I entered this line of code into a rule just to see what it does.

 

ActiveSheet.View("A").View.Suppressed = True

 In my mind, both 'A' views should dissaper from the drawing. However, upon running only the first one dissapears. So it seems they are differentiated some how. Maybe by the order they were created? or by which view they are sectioned from?

 

Is there any way i can adjust the code to differentiated between the 2 views with the same view identifier?

 

Any help is much appreciated as always,

Many Thanks

 

 


 

Tags (1)
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Anonymous

Hi,

 

I've now taken a different approach to the drawing, which removes the problem stated above. However, if there is a quick solution i'd be interested to know how to do this for future reference.

 

Many Thanks

Message 3 of 4
MjDeck
in reply to: Anonymous

You could rename the second view.  Is there a reason you don't want to rename it?


The following code will operate on both views:

Sub Main
  SetSuppressionOfViews("A", True)
End Sub

Sub SetSuppressionOfViews(viewName As String, suppressed As Boolean)
  Dim sheetX As Sheet = ThisDrawing.ActiveSheet.Sheet
  For Each viewX As DrawingView In sheetX.DrawingViews
    If (viewX.Name = viewName) Then
    viewX.Suppressed = suppressed
 End If
  Next
End Sub


Mike Deck
Software Developer
Autodesk, Inc.

Message 4 of 4
Anonymous
in reply to: MjDeck

Hi Mike,

 

Thanks for the snippet of code, i'll add it to my library. Well on my drawing I had drawing views A, B, C etc all the way to VIEW G. This was for an assembly which was small in width and height. 

 

I then had a separate set of views for an assembly which was large in width in height thus requiring 'breaks' (using the code you provided in one of my other threads 🙂

 

One of the two sets of views would supress depending on the size of the gate. So if the first set were supressed, my drawing views would start from VIEW H. Which isnt conventional, i wanted both sets to start with VIEW A which is the reason i had duplicate view identifiers. 

 

However, using your break code i relaised i could just introduce the break when needed into the first set of views; eliminating the problem all together and making the code much neater. I hope that made sense!

 

Once again, many thanks for your help, I appreciate your input 🙂

 

Regards

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report