Inventor Customization

Inventor Customization

ADN Support Specialist
636 Posts
103 Kudos
Registered: ‎03-26-2007
Post 11 of 15

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
959 Posts
97 Kudos
Registered: ‎02-24-2009
Post 12 of 15

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.

5 Posts
0 Kudos
Registered: ‎01-18-2013
Post 13 of 15

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


959 Posts
97 Kudos
Registered: ‎02-24-2009
Post 14 of 15

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.

5 Posts
0 Kudos
Registered: ‎01-18-2013
Post 15 of 15

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!




Post to the Community

Have questions about Autodesk products? Ask the community.

New Post