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: 

Automating Add material to Flat Pattern for manufacturability - vba ilogic vb.net

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
ssurratt
548 Views, 6 Replies

Automating Add material to Flat Pattern for manufacturability - vba ilogic vb.net

I am looking to automate a process we do using vba, ilogic, vb.net, etc..

For some parts we add material to the flat pattern so that the shop has something to hold onto when bending.

 

Currently - We add 1.5" of material to each side of the part by sketching onto the face of the part and extruding down to the next face. 

 

I would like to do this instead with a macro or something. 

Any ideas on how to start this?

AddToFlatPattern_manufacturability.JPG

 

Labels (7)
6 REPLIES 6
Message 2 of 7
yan.gauthier
in reply to: ssurratt

Hi, 

doing this automatically is possible, but I don't think you will be able to blindly trust the result? so you would have someone validate it created the 1.5in at the right place, in the right direction. That or you would have your code ask the user to select the edges from which he wants to add this 1.5in of material.

Because of that, I would recommend simply using the Direct-Edit feature or the flange feature with 0° angle to generate the result you desire. It's faster than generating a sketch, selecting face feature, selecting to:next.... 

 

Best Regards,

Message 3 of 7
ssurratt
in reply to: ssurratt

Thank you Yan!

I like the idea of having the code ask the user to select the edges or faces.

 

Is there a way to extrude a selected face by a specific amount? 

Somehow creating a new sketch on each face -> projecting the geometry of that face into the new sketch -> close sketch -> extrude sketch profile by 1.5" 

Message 4 of 7
yan.gauthier
in reply to: ssurratt

this is exactly what the Direct feature does. you click the face you want to extrude and set the distance. Direct-Edit can be used to scale up or down, move or stretch face. selecting an external face with the default move behavior makes this face extrude by the amount you inputDirect EditDirect Edit

 

Message 5 of 7
ssurratt
in reply to: ssurratt

Thank you for that, Yan!

I was looking for a more automated approach to this problem. 

This way someone cannot forget this step in the process and you also don't have to think as much.

 

Here is what I came up with and it works:

 

' OPEN FLAT PATTERN OF CONE
Dim oSM As SheetMetalComponentDefinition
Set oSM = oPartDoc.ComponentDefinition

Dim openFN As String
openFN = oPartDoc.FullFileName
Dim openDoc As Document
Set openDoc = oApp.Documents.Open(openFN)

' open flat pattern
oSM.FlatPattern.Edit


' Ask user if bendlines are on the edges.
Call oApp.ActiveDocument.Update2(True)
Call oApp.ActiveDocument.Rebuild2(True)


Dim faces(2) As Inventor.Face
Dim i As Integer

Dim answer As Integer
answer = MsgBox("Are the bendlines on the edges of the flat pattern?" + vbNewLine + "yes->changes facet widths in attempt to get bendlines away from edges." + vbNewLine + "no->bendlines are not near edges and now you can select the faces.", vbQuestion + vbYesNo, "Check Bend Lines")

Select Case answer
Case vbYes ' change facet width and loop until user enters no
Call set_values("SCREW CONE HALF 2-scs-iLogic.ipt", "facetSize", facetWidth - 0.5, oApp, oAsmDoc)
Case vbNo
'proceed
End Select

Dim oExtrusions As Inventor.ExtrudeFeatures
Dim oExtFeat As Inventor.ExtrudeFeature
Set oExtrusions = oSM.FlatPattern.Features.ExtrudeFeatures
For Each oExtFeat In oExtrusions
oExtFeat.Delete

Next ' oExtFeat

Call oApp.ActiveDocument.Update2(True)
Call oApp.ActiveDocument.Rebuild2(True)

' ask user for face selections


MsgBox ("Please Select the faces for extra extrusion")
For i = 1 To 2
Set faces(i) = oApp.CommandManager.Pick(Inventor.SelectionFilterEnum.kPartFaceFilter, "Select face " & i)
Next ' i

For i = 1 To 2
Dim oSketch As PlanarSketch
Set oSketch = oSM.FlatPattern.Sketches.Add(faces(i), True)
oSketch.Name = "facesketch" & i
' oSketch.ExitEdit
' extrude sketch
Dim oExtrudeDef As Inventor.ExtrudeDefinition
Dim oProfile As Inventor.Profile
Set oProfile = oSketch.Profiles.AddForSolid
Set oExtrudeDef = oSM.FlatPattern.Features.ExtrudeFeatures.CreateExtrudeDefinition(oProfile, kJoinOperation)
Call oExtrudeDef.SetDistanceExtent(1.5, kPositiveExtentDirection)
Dim oExtrude As Inventor.ExtrudeFeature
Set oExtrude = oSM.FlatPattern.Features.ExtrudeFeatures.Add(oExtrudeDef)


Next 'i

Message 6 of 7
yan.gauthier
in reply to: ssurratt

Hi,

The way I see it. Since you need your users to validate the function was done correctly. It would actually be faster to let them do it manually rather than have a program asking a bunch of questions.

 

You could simply have a procedure to validate that this feature was done. (a checklist of some sort)


in my experience, you should not use automation if it's going to make the process longer. User will find this tedious and will find ways to go around it. You could also create a macro that check if the distance between any bendlines and the end of the part is long enough ? 

Message 7 of 7
ssurratt
in reply to: yan.gauthier

Hi Yan,

 

I think maybe I wasn't clear.

Let me try to clarify.

 

The benefits of my macro are:

  • Total user input is 3 clicks.
  • Zero data entry
  • Zero added responsibility on the user to remember this one off process.
  • Zero time wasted finding/using a checklist

The only question it asks is if the bend lines are close to the end of the part. Clicking yes will fix the bend lines without having to go into the facet feature and modify the sizes. I plan to add a check on the bend line proximity to get rid of this question.

 

Manually modifying the facet sizes requires the following from the user:

  • Remember we have an allowable range for this feature
  • Find checklist/allowable range for this feature
  • Doing math to find the correct size
  • Enter the value correctly (possible data entry error)
  • Clicking 7 times to fix the facet and then get back to the flat pattern.

 

To manually extrude the faces the user would have to

  • Find and click the Direct feature (Time waste)
  • Click a side
  • Enter the distance (possible data entry error)
  • Click ok (time waste)

So that is 3 clicks and 1 manual entry per side --> 6 clicks and 2 data entries total.

 

Tasks like this over the course of a project can add up to a lot of wasted time/effort. By automating them as you encounter them, eventually you can turn an 8 hour project into a 30 second macro.

 

Hope this clears up why I prefer an automated solution instead of a manual one.

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report