Inventor Customization

ADN Support Specialist
Posts: 521
Registered: ‎03-26-2007
Message 11 of 15 (369 Views)

Re: Control 'break' size in drawing view using iLogic?

02-13-2013 02:04 AM in reply to: HvHelden



My guess is that your code indeed ended up with some special characters - perhaps not exactly a "?" but other ones that are not visible in the iLogic editor.

This assumption is supported by the fact that:

- when you copy pasted your code into the discussion forum, then the formatting got messed up and "?" characters appeared

- the error said "Error on Line 37: 'kHor' is not a member of 'Inventor.BreakOrientationEnum'." - i.e. there was something in between "kHor" and "izontalBreakOrientation" that prevented the iLogic interpreter from processing the complete string of "kHorizontalBreakOrientation"

- once you rewrote some of the parts they started working


I would suggest copying all your code from the iLogic editor into Notepad and see what you get (maybe by now you removed all the nasty special characters by rewriting things, but maybe not) If some funny characters show up or lines are broken up wrong, then correct those and then copy/paste back the code from Notepad into the iLogic editor.



Adam Nagy
Developer Technical Services
Autodesk Developer Network
Posts: 957
Registered: ‎02-24-2009
Message 12 of 15 (358 Views)

Re: Control 'break' size in drawing view using iLogic?

02-13-2013 09:42 AM in reply to: HvHelden

 To help us to resolve this error:
 "Error on Line 49 : 'view' is ambiguous, imported from the namespaces or types 'Inventor, System.Windows.Forms'."
can you post the complete text of your rule?
To avoid formatting problems, please copy and paste the text to Notepad. Then save the file as a txt file, and attach that file to your post.

Mike Deck
Software Developer
DLS - Mechanical Design
Autodesk, Inc.

Posts: 5
Registered: ‎01-18-2013
Message 13 of 15 (349 Views)

Re: Control 'break' size in drawing view using iLogic?

02-28-2013 03:02 AM in reply to: MjDeck

Hello Adam and Mike,

Thank you for helping sofar.

It's a few weeks ago that i have worked on the rule, because of i had more functions than only do engineering work.

I hope you can remember my problem, and help me solve it.

In this post, i place the textfile 'Rule0' with the iLogic rule from the .idw.


Thanks in advance!


Sub Main
'iLogicVb.RunRule("Gestandaardiseerde rol", "Rule0")
Dim BreakWithFactor As Double
Dim Bmaat=Parameter("Gestandaardiseerde rol.iam", "Bmaat")
Select Case Bmaat
Case <400
Case <1000
Case <1250
Case >1250

End Select

If "1:2" IsNot ActiveSheet.View("Lengteaanzicht").ScaleString Then
End If
End Sub

Sub DeleteBreaks
If (ActiveSheet.Name <> "Rol_compleet:1") Then Return
Dim viewL = ActiveSheet.View("Lengteaanzicht")
Dim view = viewL.View
If (view.BreakOperations.Count > 0) Then
End If

Dim xMid As Double = ActiveSheet.Sheet.Width / 2  'Helft van papierbreedte
Dim yMid As Double = ActiveSheet.Sheet.Height / 2  'Helft van papierhoogte
Dim modelDocName = IO.Path.GetFileName(viewL.ModelDocument.FullFileName)
Dim Bmaat As Double = Parameter("Gestandaardiseerde rol.iam", "Bmaat")
'If (Bmaat > 1000) Then Return
MessageBox.Show(Bmaat, "Bmaat=")
MessageBox.Show(Bmaat, "Bmaat=")
	Dim breakWidth As Double = (((Bmaat-300)/BreakWithFactor))	
	Dim startPt = ThisApplication.TransientGeometry.CreatePoint2d((xMid - (breakWidth*0.05)), yMid)
	Dim endPt = ThisApplication.TransientGeometry.CreatePoint2d((xMid + (breakWidth*0.05)), yMid)
MessageBox.Show(breakWidth, "Goed")
	'view.BreakOperations.Add(BreakOrientationEnum.kHorizontalBreakOrientation, startPt, endPt)
	', BreakStyleEnum.kStructuralBreakStyle, 10, 0.3)
End Sub


Posts: 957
Registered: ‎02-24-2009
Message 14 of 15 (344 Views)

Re: Control 'break' size in drawing view using iLogic?

02-28-2013 08:35 AM in reply to: adam.nagy

It looks like you fixed the compile error that you posted before. Here's an updated version that fixes a few other problems in the rule.

- BreakWithFactor is shared between the two Subs. It won't work if it's declared only in Main. The easiest way to do it is to declare it outside the Subs (at the VB Class level).  I moved Bmaat there as well.
- IsNot does not generally work for string comparison.  Use <> instead.

- Getting the midpoint of the sheet won't work unless the view is centered. It's better to use the view center. (I think we posted a simple example using the sheet center. We should have used the view center there as well.)

- The line to Add the break operation had an extra right parenthesis.

Mike Deck
Software Developer
DLS - Mechanical Design
Autodesk, Inc.

Posts: 5
Registered: ‎01-18-2013
Message 15 of 15 (314 Views)

Re: Control 'break' size in drawing view using iLogic?

03-05-2013 01:29 AM in reply to: MjDeck


Hi Mike!

Thanks for sharing that knowledge! :smileyhappy:


I didn't know that lines between 'subs' are also read by VB. I've copied your attachment to the iLogic rule, and it works fine! Thereafter, I was busy with figuring out how the value of breakWidth works; and the view is always between the drawing sheet.

Now, I would use not only an horizontal break on a view, but on vertical views too. (So that the length-shortening is in vertical direction). It gives me some bugs, while i changes the endPt and startPt by gives the yMid an (postive and negative, respectively) offset, and xMid where only xMid.

After that, i saw the breakstyleorientation is horizontal vs. vertical, and then it works fine!

Thank you all for helping!




You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community

Inventor Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Autodesk Inventor helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Inventor