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: 

Find Drawing View Orientation ilogic

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
johnster100
2115 Views, 6 Replies

Find Drawing View Orientation ilogic

Hi,

I've written some simple code which sets the scale of all the views in a drawing. However, I would like it skip any views which are iso, as we always have a small iso view in the corner of our drawings. The scale of these is much less that scale of the main views.

 

Is it possible to do this this in ilogic?

 

ie.

 For Each oView As DrawingView In oSheet.DrawingViews 

      if oView.ORIENTATION = iso then

            'next

     else

          oView.Scale = 1 / var

     end if

 

next

 

I have not been able to find an orientation object in the DrawingView object.

 

thanks,

John

6 REPLIES 6
Message 2 of 7
LukeDavenport
in reply to: johnster100

 

Using the DrawingView.Camera.ViewOrientationType might be good enough for you. The below code works fine for me - the only problem is if your ISO view is not a base view (its a projected or auxiliary view perhaps) then it won't be recognised as ISO in the ViewOrientationType Enum, just as 'Arbitrary'. 

Sub Main Dim oDrawDoc As DrawingDocument = ThisApplication.ActiveDocument For Each oView As DrawingView In oDrawDoc.Sheets.Item(1).DrawingViews 'Define camera
Dim cam As Camera = oView.Camera If Not oView.Camera.ViewOrientationType = 10762 AndAlso _ Not oView.Camera.ViewOrientationType = 10761 AndAlso _ Not oView.Camera.ViewOrientationType = 10760 AndAlso _ Not oView.Camera.ViewOrientationType = 10759 Then MessageBox.Show("Not an ISO base view", "Title") oView.Scale = 0.1 End If Next End Sub
Message 3 of 7
johnster100
in reply to: LukeDavenport

worked a charm.

 

thanks,

John

Message 4 of 7
LukeDavenport
in reply to: johnster100

My pleasure!

Message 5 of 7

In my case, it´s a Projected view, how can I proceed?
Like @LukeDavenport said, this way it won´t work.
Message 6 of 7

Hi @lucas_lacerda_proj ,

 

You can use something like this to check the ViewType.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

	Dim oDrawDoc As DrawingDocument = ThisApplication.ActiveDocument
	For Each oView As DrawingView In oDrawDoc.ActiveSheet.DrawingViews		

		If Not oView.ViewType = DrawingViewTypeEnum.kProjectedDrawingViewType			
			'do some stuff with non-projected views
			MsgBox(oView.Name & " is NOT a projected view.",, "iLogic")
		End If
	Next

 

	Dim oDrawDoc As DrawingDocument = ThisApplication.ActiveDocument
	For Each oView As DrawingView In oDrawDoc.ActiveSheet.DrawingViews		

		If oView.Viewtype = DrawingViewTypeEnum.kProjectedDrawingViewType			
			'do some stuff with projected views
			MsgBox(oView.Name & " is a projected view.",, "iLogic")
		End If
	Next

 

Message 7 of 7

DrawingViewTypeEnum Enumerator

Description

Drawing View Type.

Methods

Name Value Description
kAssociativeDraftDrawingViewType 10506 View is an associative draft one.
kAuxiliaryDrawingViewType 10499 View is an auxiliary one.
kCustomDrawingViewType 10498 View with customized camera setting.
kDefaultDrawingViewType 10497 Specifies the default View. The more strongly typed value is returned in a query.
kDetailDrawingViewType 10502 View is a detail of a portion of the document contents.
kDraftDrawingViewType 10505 View is a draft one.
kOLEAttachmentDrawingViewType 10500 View is an OLE attachment.
kOverlayDrawingViewType 10507 View is an overlay one.
kProjectedDrawingViewType 10504 View is a projected one.
kSectionDrawingViewType 10503 View is a section.
kStandardDrawingViewType 10501 View with the camera set to one of the standard orthogonal views (Top, Iso, etc.).

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

Post to forums  

Autodesk Design & Make Report