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: 

怎么回事?图纸上的代码出错了,谁能告诉我该怎么做?

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
38620079
257 Views, 4 Replies

怎么回事?图纸上的代码出错了,谁能告诉我该怎么做?

Sub Main() Dim oDrawingDoc As DrawingDocument = ThisApplication.ActiveDocument Dim baseScale As Double = oDrawingDoc.ActiveSheet.DrawingViews.Item(1).Scale For Each oView As DrawingView In oDrawingDoc.ActiveSheet.DrawingViews oView.Scale = baseScale Next End Sub

4 REPLIES 4
Message 2 of 5
38620079
in reply to: 38620079

What's going on? The code is running wrong in the drawing, who can tell me what to do?

Message 3 of 5
FINET_Laurent
in reply to: 38620079

Hi,

 

Make sure the view you are chaning the scale is a main view and not an projected view, section views, etc. since those views scale are linked to the main ones : 

Sub Main() 
	Dim oDrawingDoc As DrawingDocument = ThisApplication.ActiveDocument 
	Dim baseScale As Double = oDrawingDoc.ActiveSheet.DrawingViews.Item(1).Scale
	
	For Each oView As DrawingView In oDrawingDoc.ActiveSheet.DrawingViews 
		If oView.Type <> DrawingViewTypeEnum.kStandardDrawingViewType Then Continue For			
		oView.Scale = baseScale
		
	Next 
End Sub

 

Kind regards,

FINET L.

 

If this post solved your question, please kindly mark it as "Solution"

If this post helped out in any way to solve your question, please drop a "Like"

@LinkedIn     @JohnCockerill

Message 4 of 5
vpeuvion
in reply to: 38620079

Hi, you can try this:

Sub Main()
	Dim oDrawingDoc As DrawingDocument = ThisApplication.ActiveDocument 
	Dim baseScale As Double = oDrawingDoc.ActiveSheet.DrawingViews.Item(1).Scale
	For Each oView As DrawingView In oDrawingDoc.ActiveSheet.DrawingViews 
		If oView.ViewType = 10501 Then oView.Scale = baseScale 
	Next 
End Sub

 Vincent.

Message 5 of 5
38620079
in reply to: FINET_Laurent

噢!I see 谢谢

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report