How to manage detail and section

How to manage detail and section

Anonymous
Not applicable
292 Views
1 Reply
Message 1 of 2

How to manage detail and section

Anonymous
Not applicable

Hello All, 

I want to manage detail and section by name. 

If some parametr from part in assembly is true/ false or some value, then I want to change visibility of detail (suppress them)  

 

For exmpl. 

modelNameHorniUkos = IO.Path.GetFileName(ActiveSheet.View("Base_Component").ModelDocument.FullFileName)

If Parameter(modelNameHorniUkos &".d20") = 0 mm   Then 
	ThisDrawing.Sheet("Sheet:1").View("horni ukos").View.Suppressed = True
	Else
		ThisDrawing.Sheet("Sheet:1").View("horni ukos").View.Suppressed = False	
End If

 

But, I need to rename detail from A to Z. I have VBA code for it, but when I run the code, I´m not able to manage detail suppress. Because details are managing by name. 

Can anybody help me? 

thank you.

0 Likes
293 Views
1 Reply
Reply (1)
Message 2 of 2

WCrihfield
Mentor
Mentor

Since I don't know how many sheets there may be, and how many views there may be, I am using two loops to search all sheets and all views on each sheet.  It checks if the view is either a Detail view or a Section view, then checks the value of a certain parameter from the model file, then depending on how you want it to react, either suppresses or unsuppresses the view.

Would something like this work for you?

 

Dim oDDoc As DrawingDocument = ThisDrawing.Document
Dim oModelParams As Parameters = ThisDrawing.ModelDocument.ComponentDefinition.Parameters
For Each oSheet As Sheet In oDDoc.Sheets
	For Each oView As DrawingView In oSheet.DrawingViews
		If oView.ViewType = DrawingViewTypeEnum.kDetailDrawingViewType Or _
			oView.ViewType = DrawingViewTypeEnum.kSectionDrawingViewType Then
			If oModelParams.Item("d20").Value = 0 Then
				oView.Suppressed = True
			Else
				oView.Suppressed = False
			End If
		End If
	Next
Next

 

 

I hope this helps.
If this solves your problem, or answers your questions, please click 'Accept As Solution".
Or, if this helps you reach your goal, please click 'LIKES" 👍.

 

Also, if you're interested, here are a few of the 'Ideas' I'd like to get implemented.
If you agree with any of them, please vote for them.

  • Add more capabilities to the 'Customize' dialog box (exe. Add Tab & Add Panel) Click Here
  • Constrain & Dimension Images In Assembly Sketches & Drawing Sketches (TitleBlocks & SketchedSymbols) Click Here
  • Save Section View Status In DesignViewRepresentation (So It Can Be Used In The Drawing) Click Here
  • Add SolidBodies Folder In iLogic Rule Editor Model Tab Click Here
  • Convert All Views To Raster Before Autosave Stores To 'OldVersions' Folder Click Here
  • SetDesignViewRepresentation - Fix limitations for DrawingView of a Part Click Here
  • Create DocumentSubTypeEnum Click Here
  • Add kRevisionTag or kDrawingRevisionTag to ObjectTypeEnum Click Here

Inventor 2020 Help | Inventor Forum | Inventor Customization Forum | Inventor Ideas Forum

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes