Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Sketch Repair & Enhancement Tool written in iLogic

10 REPLIES 10
Reply
Message 1 of 11
ad64
3047 Views, 10 Replies

Sketch Repair & Enhancement Tool written in iLogic

Attached is an Inventor Sketch Repair Tool that I wrote in iLogic.

 

It can very quickly Auto-constrain sketches that have been copied in from AutoCAD in an orderly way, producing better results than Inventor's built-in tool.

 

It can also be used to repair and re-constrain poorly-constrained sketches already created in Inventor while preserving their geometry and existing dimensions wherever possible. It can straighten crooked lines, synchronize similar radii, fix tangential curve problems, round dimensions, etc.

 

A typical workflow, depending on what the user selects might include:

  1. Deleting existing sketch dimensions and storing them in an array. After the tool has run it will replace the dimensions from the array onto the sketch.
  2. Then deleting all constraints of selected types.
  3. Then Auto-constraining the sketch in an orderly way. The user can customize which constraints are placed as well as what tolerance is used when determining which lines should be vertical, horizontal, or colinear and which curves should be tangential.
  4. Synchronizing the radii to a given tolerance. For example, in a sketch imported from AutoCAD it can recognize that 8.100342, 8.100215, 8.099942, and 8.100023 should all be the same and apply an equal constraint between them.
  5. Rounding all dimensions to a given tolerance. After setting the radii equal in step 4, it can round them all to 8.1 recognizing that this is what they are intended to be.
  6. Removing any driven dimensions that are left over as a result after the tool has run.

 

The sub-routines can also be run individually to:

  • delete all dimensions and/or constraints of a given type (or of all types) in a sketch.
  • auto-constrain a sketch with only the types of constraints selected and to the selected tolerance.
  • round all dimensions to a given precision.

 

A couple of caveats:

  • I have not tested it in Inventor 2014, but it works well in Inventor 2013.
  • On rare occasions it will create an over-constrained condition and error out when rounding dimensions.

 

I'm posting the Sketch Repair Tool so that the community can benefit from it and also possibly work together to improve it. Possible enhancements include:

  • Adding the ability to determine which lines should be coincident on sketches imported from AutoCAD and auto-apply the constraint if it is missing.
  • Detecting two lines on top of each other and determining which to remove.
  • Determining the source of the over-constrain errors that sometimes occur and adding the ability to avoid them.
  • Adding the ability to auto-dimension in a smarter way than Inventor does.
  • Improving the code efficiency

Some of the code that iLogic users may find especially interesting include the way that it analyzes and fixes tangent curves and the way that it analyzes and synchronizes radii.

 

I've included a few bad sketches for testing. You can also copy your own geometry into a sketch within the file and run it.

 

Any feedback, critiques or improvements are welcome.

 

Steve

10 REPLIES 10
Message 2 of 11
stephengibson76
in reply to: ad64

this looks really good, hopefully get a chance to test it in the coming weeks

Stephen Gibson



View stephen gibson's profile on LinkedIn


Message 3 of 11
Carthik_Babu
in reply to: ad64

Dear Sir,

Can you post the ilogic code. since i am not able to open the file.

Carthik Babu M.S, Asst Manager - Machine Building,
Gabriel India Ltd,Hosur, TN, INDIA
Email:carthik_ms@yahoo.co.in ,
https://grabcad.com/carthik-1/projects
"May all beings be happy" http://www.dhamma.org/
Message 4 of 11
ad64
in reply to: Carthik_Babu

The code is attached.

 

Steve

Message 5 of 11
Carthik_Babu
in reply to: ad64

Great Work.....no words to say......Thanks a lot for sharing......100 likes for this work and for your knowledge sharing attitude........ 🙂
Carthik Babu M.S, Asst Manager - Machine Building,
Gabriel India Ltd,Hosur, TN, INDIA
Email:carthik_ms@yahoo.co.in ,
https://grabcad.com/carthik-1/projects
"May all beings be happy" http://www.dhamma.org/
Message 6 of 11
AlexFielder
in reply to: ad64

This is an excellent little tool.

 

Obviously the iLogic needs to be run after having used the Auto Dimension tool in the sketch, but it would be nice if the tool asked the user for datum edge(s) to dimension from - this would mean the resultant dimensions could be pulled through into the part/assembly drawing without having to recreate them.

 

Naturally, the above request is probably beyond the scope of this tool and is probably something that Autodesk themselves should be looking to implement, but since you asked for suggestions, this was mine.

 

Thanks,

 

Alex.

Message 7 of 11
Davarn-Tool&Die
in reply to: ad64

Thank you for all your work in not only writing the code, but in releasing it to the Inventor community.

 

I'm having problems getting this to work with my own sketches. I am using 2014 but the examples work, although not perfectly. For instance, the first example, (the roughly "L" shaped sketch) constrains all but 90 unconstrained elements (392 reduced to 90, not bad).

 

When I transfer the Ilogic code to one of my earlier parts, the commands ask the right questions, "do you want to apply the constraints?", but then does nothing.

 

Also the form "--Sketch Repair Assistant--" shows all the settings in the example, but in my sketches they are greyed out.

 

A 2014 problem, or am I doing something wrong?

 

Message 8 of 11

Hi,

 

If u transfer the ilogic code, u need to transfer parameters too into your file, which are necessary for Sketch Tools.

 

Kindly import Parameters(Manage Tab--> Parameters Tab-->Import from XML) from the XML Attached and then run the code.

Carthik Babu M.S, Asst Manager - Machine Building,
Gabriel India Ltd,Hosur, TN, INDIA
Email:carthik_ms@yahoo.co.in ,
https://grabcad.com/carthik-1/projects
"May all beings be happy" http://www.dhamma.org/
Message 9 of 11
ad64
in reply to: Davarn-Tool&Die

Yes, Carthik is correct.

 

The routine needs the parameters in the file to run. I did it this way so that it would hold their values for the next time the tool runs. My intended use was that sketches would be copied from AutoCAD or another Inventor file into the Sketch Repair Tool for constraining. Once they are constrained they can then be copied out again into a new file. Almost all of my sketch profiles end up being blocks so I just create a block after they are constrained and copy it to a new file.

 

Also, the code only constrains the geometry, it does not dimension it. This is why there are still 90 constraints to be placed. Those are the dimensions that you need to place to fully define the profile.

 

Steve

Message 10 of 11
ad64
in reply to: AlexFielder

Hi Alex,

 

Personally I would avoid Autodesk's Auto Dimensioning tool altogether, because it produces a mess - both with geometric constraints and dimensions.

 

Typically I use the sketch repair tool for imported sketches from AutoCAD. As soon as I copy the geometry into the file from AutoCAD, I run the tool to place as many of the automatic geometric constraints as possible (often several hundred, so this saves quite a bit of time as opposed to doing it manually). Then, I manually place any required dimensions to fully constrain it.

 

The reason why the tool contains an option for removing and replacing dimensions is because I will use it to repair badly constrained Inventor sketches created by someone else. For example, it is poor practice, in my opinion, to use parallel or perpendicular constraints for a line that should be constrained vertically or horizontally. Or, dimensions are being used when a constraint should be used: for example, an angular constraint being used to hold a line vertical or parallel. In most cases, these sketches are well dimensioned but just poorly constrained (perhaps due to the Auto Dimensioning tool being used). The sketch repair tool can be used to repair the constraints without disturbing the dimensions any more than necessary.

 

It would be possible to create a tool in iLogic to auto-dimension as you descibe, but the problem would be the logic side of it. How could a computer logically place dimensions as well as a person since it can't understand the design intent for the profile, which is the main driver for dimension placement.

 

Steve

Message 11 of 11
AlexFielder
in reply to: ad64

Arrrrrrggggh, Brains... (everyone likes a good zombie thread right?)

I just stumbled back into this thread whilst searching for something unrelated, but I digress:

This actually is more feasible as a tool/function/rule now that we have the named geometry feature in Inventor 2019.

I suppose the missing link is the ability to create "named sketch geometry"? I guess though that since we can now dimension/annotate in 3D, that is less of an issue?

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

Post to forums  

Autodesk Design & Make Report