Inventor Customization

Reply
Contributor
andrew.reynolds
Posts: 16
Registered: ‎10-25-2010
Message 1 of 15 (916 Views)
Accepted Solution

Control 'break' size in drawing view using iLogic?

916 Views, 14 Replies
02-24-2011 09:14 PM

Hi all,

 

Is there any way using iLogic or other method to automatically control the size of the 'break' in a drawing view? I have built a model which uses iLogic to control virtually everything, however the large variations in the length of the product mean that there are some interesting results when it comes to the broken drawing views updating.

 

Ideally, it would be nice to locate the break at the absolute center of the view and then size it as a percentage of the view size along one axis or perhaps according to some other length based rule.

 

Any ideas are greatly appreciated!

 

Cheers.

 

AndrewR

Dell Precision M6400 - C2D 2.66 / 8gb / Quadro FX3700M / Win 7 Pro x64
Employee
MjDeck
Posts: 957
Registered: ‎02-24-2009
Message 2 of 15 (890 Views)

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

03-02-2011 12:00 PM in reply to: andrew.reynolds

On Inventor 2011, look at the iLogic 2011 Samples project. In the Drawings directory there is a file named BreakView.idw.  It has a rule that will adjust the width of a break in the view to maintain a constant view width.  To do it, it deletes and then recreates the break.  Here is the rule:

 

If (ActiveSheet.Name <> "Sheet:1") Then Return
Dim viewL = ActiveSheet.View("VIEW1")
Dim view = viewL.View
If (view.BreakOperations.Count > 0) Then
  view.BreakOperations(1).Delete
End If

Dim xMid As Double = ActiveSheet.Sheet.Width / 2
Dim modelDocName = IO.Path.GetFileName(viewL.ModelDocument.FullFileName)
Dim modelLength As Double = Parameter(modelDocName, "Length")
If (modelLength < 12) Then Return
Dim breakWidth As Double = (modelLength - 10) * 2.54
Dim startPt = ThisApplication.TransientGeometry.CreatePoint2d(xMid - breakWidth/2, 0)
Dim endPt = ThisApplication.TransientGeometry.CreatePoint2d(xMid + breakWidth/2, 0)
view.BreakOperations.Add(BreakOrientationEnum.kHorizontalBreakOrientation, startPt, endPt)

 



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

Contributor
andrew.reynolds
Posts: 16
Registered: ‎10-25-2010
Message 3 of 15 (886 Views)

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

03-02-2011 03:23 PM in reply to: andrew.reynolds

Hi Mike,

 

I had looked around but the samples were the last place i had thought of... excellent advice!

 

I'm adapting the code  to suit my model, but i've got an error message appearing that says "The parameter is incorrect".

 

I know the first section that removes the break is correct as that is working, it's just not creating the new break.

 

 

ActiveSheet.View("DETAIL").SetCenter(320, 200) 'If changing center pos, remember to change break geometry below

If (ActiveSheet.Name <> "Sheet:1") Then Return
Dim viewL = ActiveSheet.View("DETAIL")
Dim view = viewL.View
If (view.BreakOperations.Count > 0) Then
view.BreakOperations(1).Delete
End If

Dim xMid As Double = 320
Dim modelLength As Double = Parameter("2BFD_MESH.iam", "BW_LEN")
If (modelLength < 500) Then Return
Dim breakWidth As Double = (modelLength - 450) / 4
Dim startPt = ThisApplication.TransientGeometry.CreatePoint2d(xMid - breakWidth/2, 0)
Dim endPt = ThisApplication.TransientGeometry.CreatePoint2d(xMid + breakWidth/2, 0)
view.BreakOperations.Add(BreakOrientationEnum.kHorizontalBreakOrientation, startPt, endPt)

 

Cheers.

AndrewR

Dell Precision M6400 - C2D 2.66 / 8gb / Quadro FX3700M / Win 7 Pro x64
Employee
MjDeck
Posts: 957
Registered: ‎02-24-2009
Message 4 of 15 (884 Views)

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

03-02-2011 04:43 PM in reply to: andrew.reynolds

 I think the error is caused by the breakpoint being outside of the view.  I should have mentioned that these are Inventor API calls, and all API calls require coordinates and lengths in units of cm.  But iLogic works in document units. It looks like your drawing units are mm. Here's some changes that should fix it:

 

Dim startPt = ThisApplication.TransientGeometry.CreatePoint2d((xMid - breakWidth/2) * 0.1, 0)
Dim endPt = ThisApplication.TransientGeometry.CreatePoint2d((xMid + breakWidth/2) * 0.1, 0)

 



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

Contributor
andrew.reynolds
Posts: 16
Registered: ‎10-25-2010
Message 5 of 15 (880 Views)

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

03-02-2011 04:58 PM in reply to: MjDeck

As always Mike, you're right on the money.

 

It seems strange that the API requires units of centimetres when it's neither American nor metric! Oh well, live and learn...

 

For anyone interested in the add break function, there are additional parameters you can include to control the style and sizing of the symbol... For instance my line below uses the structural style symbol at 10 display size with a gap of 3mm.

 

view.BreakOperations.Add(BreakOrientationEnum.kHorizontalBreakOrientation, startPt, endPt, BreakStyleEnum.kStructuralBreakStyle, 10, 0.3)

Once again, thanks for the help Mike!

AndrewR

Dell Precision M6400 - C2D 2.66 / 8gb / Quadro FX3700M / Win 7 Pro x64
Contributor
andrew.reynolds
Posts: 16
Registered: ‎10-25-2010
Message 6 of 15 (788 Views)

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

03-31-2011 06:08 PM in reply to: andrew.reynolds

Hi Mike,

 

I have moved on to my next incarnation of this project, and the drawing now requires 2 breaks to be added to the view. I have managed to get the creation of the 2 new break lines to work fine, it's the removal of the existing breaks that is causing an issue for me. Can you please let me know what the syntax would be to clear all of the breaks on a particular view? Below is what you suggested to remove a single break, but now there is more than 1 on the view...

 

The obvious "view.BreakOperations(2).Delete" causes an error.

 

If (ActiveSheet.Name <> "Sheet:1") Then Return
Dim viewL = ActiveSheet.View("DETAIL")
Dim view = viewL.View
If (view.BreakOperations.Count > 0) Then
view.BreakOperations(1).Delete
 End If
AndrewR

Dell Precision M6400 - C2D 2.66 / 8gb / Quadro FX3700M / Win 7 Pro x64
Employee
MjDeck
Posts: 957
Registered: ‎02-24-2009
Message 7 of 15 (775 Views)

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

04-01-2011 06:08 AM in reply to: andrew.reynolds

This will do it:

For Each breakOp In view.BreakOperations
  breakOp.Delete
Next

 



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

Member
HvHelden
Posts: 5
Registered: ‎01-18-2013
Message 8 of 15 (409 Views)

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

02-12-2013 06:13 AM in reply to: andrew.reynolds

Hello,

 

When reading the posts in this subject, I was very apreciated. That while I was searching for doing the same rules for my assembly; with the same reason. (too large for drawing sheet).

 

When i copied the lines to my Rule in iLogic, i think i see an problem with those lines.

Especially the last 3 lines gives me errors. iLogic doesn't understand the frases.

DimstartPt=ThisApplication.TransientGeometry.CreatePoint2d(xM?id-breakWidth/2*0.1, 0)DimendPt=ThisApplication.TransientGeometry.CreatePoint2d(xM?id+breakWidth/2*0.1, 0)view.BreakOperations.Add(BreakOrientationEnum.kHor?izontalBreakOrientation, startPt, endPt)

In my iLogic, the words 'Dim' and 'ThisApplication' where known by iLogic, even the characters like /, *, + and the numbers. But words like TransientGeometry.CreatePoint2d where brown, so i think iLogic doesn't understand it, isn't it?

1 error more in the last line, kHorizontalBreakOrientation was the same problem; 'kHor' is not a member of Inventor.BreakOrientationEnum, he said.

Edit Rule Rule0_2013-02-12_15-09-05.jpg

 

I hope someone could help me with this code, I like to use this.

Thanks in advance!

 

HvHelden

 

ADN Support Specialist
adam.nagy
Posts: 521
Registered: ‎03-26-2007
Message 9 of 15 (397 Views)

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

02-12-2013 02:16 PM in reply to: HvHelden

Hi,

 

The brown colour does not mean that iLogic does not understand the property - as you can see in the previously posted posts as well, which are working for others.

 

It seems that your code just has some organizational issues:

- the "0)" line should be ending the previous line instead of starting a new one

- remove the "?" question marks from the code

 

Cheers,



Adam Nagy
Developer Technical Services
Autodesk Developer Network
Member
HvHelden
Posts: 5
Registered: ‎01-18-2013
Message 10 of 15 (387 Views)

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

02-13-2013 01:12 AM in reply to: adam.nagy

Hello!

Thanks for your reply,

 

The suggests you did weren't the problem, in my iLogic rule none ?-symbol visible, and the "0)" point is the end of an line, view.BreakOperations.Add stands on an new line.

 

I've rewrite some line's (except copy, only overwrite by myself) and errors from before were resolved!

Current problem is only the 'view' in view.BreakOperations.Add(

iLogic gives me the error: "Error on Line 49 : 'view' is ambiguous, imported from the namespaces or types 'Inventor, System.Windows.Forms'."

 

After retype the word 'view' and more, the ambiguous error occur.

MjDeck and Adrew.reynolds, dit that error in your rule even occur?

I'am very curious about the reason.

 

Thanks in advance for help!

HvHelden

 

PS: (The 'delete-break lines' work fine)

 

 

 

 

You are not logged in.

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

Announcements
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

Twitter

Facebook

Blogs

Pinterest

Youtube