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: 

Analyze sketch

2 REPLIES 2
Reply
Message 1 of 3
kg
Explorer
6355 Views, 2 Replies

Analyze sketch

Hi All

 

Being all new and complete virgin-like, to ilogic, I would like to know wether it is possible to analyze a sketch (wenn it is being closed)?

 

What I want to analyze is:

 

Does the sketch contain a fully constrained closed loop?

Does this closed loop consist only of straight lines?

What is the total number of lines in the loop?

 

Next fase is:

Create an excel-sheet with the following information:

For each line in this closed loop i wish to add the length of the line, and the angle to the next line (consequently on the internal side of the loop, resulting in angles from 0 to 180 degrees)

 

Have any of you done something like this before?

 

Best Regards

 

Kristjan Geirsson

(ilogic virgin)

 

Tags (3)
2 REPLIES 2
Message 2 of 3
adam.nagy
in reply to: kg

Hi,

 

If you cannot find some functionality in the iLogic browser, then you can also use the Inventor API. If you need to use that the easiest is to try to write the code in VBA and then move it to iLogic.

 

This code iterates through all the sketches and then looks at their content - might be helpful as a starting point:

Dim doc As PartDocument
doc = ThisDoc.Document

Dim sk As PlanarSketch
For Each sk In doc.ComponentDefinition.Sketches
    Dim numNotLine As Integer
    numNotLine = sk.SketchEntities.Count - sk.SketchLines.Count

	MessageBox.Show( _
      "Sketch name = " + sk.Name + vbCrLf + _
      "Number of entities = " + Str(sk.SketchEntities.Count) + vbCrLf + _
      "Number of entities not a line = " + Str(numNotLine) + vbCrLf + _
      "ConstraintStatus = " + Str(sk.ConstraintStatus) + vbCrLf + _
      "kFullyConstrainedConstraintStatus = 51713", "Results")
Next

Cheers,



Adam Nagy
Autodesk Platform Services
Message 3 of 3
kg
Explorer
in reply to: adam.nagy

Thanks

Let me try this out and maybe go on from there!

 

BR Kristjan Geirsson

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

Post to forums  

Autodesk Design & Make Report