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:
The sub-routines can also be run individually to:
A couple of caveats:
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:
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
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.
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?
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.
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
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