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: 

iLogic Coding to Create Automated Drawing

132 REPLIES 132
SOLVED
Reply
Message 1 of 133
mehatfie
44543 Views, 132 Replies

iLogic Coding to Create Automated Drawing

Hi all,

I'm attempting to create a model that autmotaically derives ready-to-go drawings. I've gotten pretty far in doing so but have a few issues with regards to dimensioning. As I'm sure you're aware, when the model changes, a dimension to that feature, which has been removed, is also deleted and some those dimensions do not return once the model is changed back.

I have looked into using different view representations, but have found that they do not accommodate feature supression.

My questions are:

Is there a way to program in the dimensioning of a view

Create center points for of of the holes and center lines

And for a feature note such as "Hole and Thread" dimensioning, when the model expands, the leader and text length do not change and proceed into the view. Is there a way to fix or anchor the text to a certain spot on the drawing, and have the leader length expand and change accordingly to that point.

If you would like farther information, or think a similar question would help, please ask. Thanks in advance for any help.

Mitch

132 REPLIES 132
Message 121 of 133
F.Goncalves
in reply to: mehatfie

Hi! thanks a lot for your help on this.

im trying to understand this code, but it's to complex for me right now. Is it possible for you to adapt you code for the simple piece that i have attached? That way maybe I can start to understand the code and develop some coding for bigger pieces.

 

once again thanks for the help!

Consider using "Accept as Solution" / "Kudos" if you find this helpful.
--
F.Goncalves
Message 122 of 133
KurtTrojan
in reply to: mehatfie

Hi I have been trying to use the code to place dimesnions as done in the thread. I am having problems getting it to work though. Particularrly in one line as below.

 

 

"    oDimension = oSheet2.DrawingDimensions.GeneralDimensions.AddLinear(oPt, oIntent1, oIntent2, kLinearDimensionType, True, DimStyle)"

 

I have copied the code posted into visual studio and everything is fine except for KLinearDimesnion which visual studio says is not decalared? I have looked back through the supplied code and cant find anywhere where Klineardimension is declared in any version of the dimensioning code. Am I missing something?

 

Thanks

 

 

Message 123 of 133
nmunro
in reply to: KurtTrojan

A couple of things.

 

When working in VB.Net you must use the fully qualified enumerated type, so the reference to the dimension type would have to be DimensionTypeEnum.kLinear...

 

Secondly, there is no kLinearDimensionType member in the DimensionType enumerator, Have a look in the help sysem for the options you have (horizontal, vertical, diameter, etc).

 

Neil

 

        


https://c3mcad.com

Message 124 of 133
waynehelley
in reply to: mehatfie

Hi all,

 

I have been trying to use snippets of the script in order to automate dimension creation.

 

Can anybody see where I am going wrong i these scripts?

Wayne Helley
Inventor 2013 Certified Professional

Autodesk Inventor Professional 2023
Visual Studio 2022
Windows 10 Pro, 64-bit
Message 125 of 133
waynehelley
in reply to: mehatfie

If anybody could post an example of this code running in Inventor 2015, that would be great.

 

Wayne

Wayne Helley
Inventor 2013 Certified Professional

Autodesk Inventor Professional 2023
Visual Studio 2022
Windows 10 Pro, 64-bit
Message 126 of 133
fsdolphin
in reply to: waynehelley

@mehatfie

 

Sorry to resurect this all thread but I'm trying to use you code and I keep getting an error.

 

Can you please help me to figure this out?  Here is what I did, I basically copied and pasted your code into a new iLogic rule and changed the URL for the drawing template. When I use it, It creates a drawing with three views but then I get the following error.

 

 ERROR: 

Error in rule: auto-drawing, in document: auto-drawing.ipt

The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))

 

MORE INFO:

System.ArgumentException: The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
   at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
   at Inventor.DimensionStylesEnumerator.get_Item(Object Index)
   at LmiRuleScript.CreateLinearDimension(DrawingDocument oDrawingDoc, DrawingView oDrawingView, DoubleForEquals DimensionLength, String DirectionOfDim, Double OffsetDistance, String DimensionLocation, Boolean ReferencedDim)
   at LmiRuleScript.Main()
   at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
   at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)

 

FYI - The Sheet Metal part I'm trying to create a drawing for is a simple 2 bend L bracket.

 

Message 127 of 133
fsdolphin
in reply to: wr.butler

@wr.butler

@kylenilsen

Did you ever resolved the issue? I'm getting the same error. Thanks.

Message 128 of 133
Jef_E
in reply to: fsdolphin

Hi,

 

I'm trying to do some drawing automation too but, i'm looking for a way to count all the centerlines that are in a certain view.

 

How can you do this? I can only find drawing curves. But they are not in this collection, they are in the sheet.centerlines.



Please kudo if this post was helpfull
Please accept as solution if your problem was solved

Inventor 2014 SP2
Message 129 of 133
Thomas.Long
in reply to: mehatfie

I don't suppose you have a section of code for automatic ordinate dimensions? I have the locations and will have the names of the parts that it needs to dimension to provided in my code, if that helps at all.

Message 130 of 133
raghavansayee
in reply to: mehatfie

Hi This is wonderful. Do you think you could upload your model (if this is not an issue) so that I can refer back to parameter settings?

or you could mail me the model / or transfer using we transfer.

this would be a great.

Thanks

 

Message 131 of 133
kusak.vojtech
in reply to: mehatfie

Hi, 

on start really good job !! For my not working jet, but no because your code is wrong but because my assembly is not set up for this type of the parameter you using. 

I would like to know if you can just explain to me what is some parameter because "Right_Project" can be exported from part. In part can means length of the part or diameter of the hole, To be honest i just would like to know what is what.  Do you use Attribute helper to set up parameter ? 

 

"Right_Project"

"Horizontal".075, "Top" 

"Horizontal".075, "Bottom" 

"Vertical" 

"Left"
"right"

"Top"

"Chute Front Side:1" + rest of the others

I understand you commented this code a i am should be able to do it but tried.

I think you was use Attribute helper to attach every face or point one parameter to spec. where dimension will start and where will be end.then rest make sense. but what is "d23" "d38" I think that is export from part to assembly and then use in this rule to get value on drawings. I really would like to see it. It is nice program and looks pretty. 

 

 

If you can attach the assembly I can work out by my self. I do understand you do not want to share this sensitive information to every one but if you decide to send me this assembly then kusak.vojtech@gmail.com

I think I can bring some ideas to you I will work on it and I am able to send you back. I just do not wan to write this code again. (btw. do not know how properly)

And also if you not going to help me no problem. I really do understand and just please be honest and send me email with something please.

 

really thank you !   

 

 

 

Message 132 of 133
AMISTRYZ5Q34
in reply to: MjDeck

The code works well, but I was wondering if we could somehow manually input the scale for individual parts right after we say yes on a dialog box?

Message 133 of 133
OliverXL5YM
in reply to: mehatfie

Hi! I am trying to use this code to add and remove balloons when parts in my assembly are also suppressed and unsuppressed. But when I unsuppress a part the balloon doesnt show back up. How do I use the code you applied for dimensions for this balloon issue. Thanks!

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

Post to forums  

Autodesk Design & Make Report