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: 

bend (fillet) between two lines in a 3dsketch

7 REPLIES 7
Reply
Message 1 of 8
EdHa
729 Views, 7 Replies

bend (fillet) between two lines in a 3dsketch

I generate 3 points, two lines between point 1,2 and 2,3 and make a bend between the two lines. Cannot do it correctly.

On one side the fillet is not trimmed correctly. I think it is a bug in Inventor. Also when I have the sketch I manually cannot make a decent bend/fillet in the 3D sketch I created.

 

Who knows what is happening, and how to solve it ?

 

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        'add 3d sketchpoints in open partdoc
        Dim oPartDoc As PartDocument
        Dim oPartDef As PartComponentDefinition
        Dim oTG As TransientGeometry

        oTG = _invApp.TransientGeometry
        oPartDoc = _invApp.ActiveDocument
        oPartDef = oPartDoc.ComponentDefinition

        Dim oSketch As Sketch3D

        oSketch = oPartDef.Sketches3D.Add()

        Dim sp1(2) As SketchPoint3D
        Dim rod(1) As SketchLine3D

        sp1(0) = oSketch.SketchPoints3D.Add(oTG.CreatePoint(0, 0, 10))
        sp1(1) = oSketch.SketchPoints3D.Add(oTG.CreatePoint(0, 0, 0))
        sp1(2) = oSketch.SketchPoints3D.Add(oTG.CreatePoint(10, 0, 0))

        rod(0) = oSketch.SketchLines3D().AddByTwoPoints(sp1(0).Geometry, sp1(1).Geometry)
        rod(1) = oSketch.SketchLines3D().AddByTwoPoints(sp1(1).Geometry, sp1(2).Geometry)

        'bending it
        oSketch.SketchArcs3D.AddAsBend(rod(0), rod(1), 2.5)

  
 

    End Sub

 

The resulting part-file is added, for who wants to try to get a bend with both sides trimmed correctly.

Tags (1)
7 REPLIES 7
Message 2 of 8
Mario-Villada
in reply to: EdHa

Hi,

I was able to replicate your issue. I don't know what the problem is but I have noticed that if you add a coincident constraint to 2 points at the intersection of the lines, you get the result you want.

This VBA code worked for me. Don't ask me why.

 

Private Sub bend()
        'add 3d sketchpoints in open partdoc
        Dim oPartDoc As PartDocument
        Dim oPartDef As PartComponentDefinition
        Dim oTG As TransientGeometry
        
        Set oTG = ThisApplication.TransientGeometry
        Set oPartDoc = ThisApplication.ActiveDocument
        Set oPartDef = oPartDoc.ComponentDefinition

        Dim oSketch As Sketch3D

        Set oSketch = oPartDef.Sketches3D.Add()

        Dim sp1(2) As SketchPoint3D
        Dim rod(1) As SketchLine3D

        Set sp1(0) = oSketch.SketchPoints3D.Add(oTG.CreatePoint(0, 0, 10))
        Set sp1(1) = oSketch.SketchPoints3D.Add(oTG.CreatePoint(0, 0, 0))
        Set sp1(2) = oSketch.SketchPoints3D.Add(oTG.CreatePoint(10, 0, 0))

        Set rod(0) = oSketch.SketchLines3D().AddByTwoPoints(sp1(0).Geometry, sp1(1).Geometry)
        Set rod(1) = oSketch.SketchLines3D().AddByTwoPoints(sp1(1).Geometry, sp1(2).Geometry)

        'bending it
        Dim oBend As SketchArc3D
        Set oBend = oSketch.SketchArcs3D.AddAsBend(rod(0), rod(1), 2.5)
        Call rod(1).StartSketchPoint.ConnectTo(rod(0).EndSketchPoint)

    End Sub

 hope it helps.

 

Please accept as solution and kudos if this helped you.

Message 3 of 8
EdHa
in reply to: Mario-Villada

I solved the problem.

 

Instead of:

 

      rod(0) = oSketch.SketchLines3D().AddByTwoPoints(sp1(0).Geometry, sp1(1).Geometry)
        rod(1) = oSketch.SketchLines3D().AddByTwoPoints(sp1(1).Geometry, sp1(2).Geometry)

 

use:

 

      rod(0) = oSketch.SketchLines3D().AddByTwoPoints(sp1(0), sp1(1))
        rod(1) = oSketch.SketchLines3D().AddByTwoPoints(sp1(1), sp1(2))

 

I should not have passe the Point object but the Sketchpoint3D object itself.

Message 4 of 8
daniel6QL3E
in reply to: EdHa

Hello,


i have the same problem but when i try to add the radius with the method AddAsBend i get a runtime error: -2147467259 (80004005)

 

The method "AddAsBend" for the object "SketchArcs3D" failed.

 

Does anyone know what could be the reason for this?

 

Here again the code used in Inventor 2021:

 

'add 3d sketchpoints in open partdoc
Dim oPartDoc As PartDocument
Dim oPartDef As PartComponentDefinition
Dim oTG As TransientGeometry

Set oTG = ThisApplication.TransientGeometry
Set oPartDoc = ThisApplication.ActiveDocument
Set oPartDef = oPartDoc.ComponentDefinition

Dim oSketch As Sketch3D

Set oSketch = oPartDef.Sketches3D.Add()

Dim sp1(2) As SketchPoint3D
Dim rod(1) As SketchLine3D

Set sp1(0) = oSketch.SketchPoints3D.Add(oTG.CreatePoint(0, 0, 10))
Set sp1(1) = oSketch.SketchPoints3D.Add(oTG.CreatePoint(0, 0, 0))
Set sp1(2) = oSketch.SketchPoints3D.Add(oTG.CreatePoint(10, 0, 0))

Set rod(0) = oSketch.SketchLines3D().AddByTwoPoints(sp1(0), sp1(1))
Set rod(1) = oSketch.SketchLines3D().AddByTwoPoints(sp1(1), sp1(2))

'bending it
Call oSketch.SketchArcs3D.AddAsBend(rod(0), rod(1), 2.5)
Message 5 of 8
WCrihfield
in reply to: daniel6QL3E

@EdHa 

I think the problem may stem from an application options setting.

Open your application options dialog box; go to the Sketch tab; near the bottom, under 3D Sketch header is an option called "Auto-bend width 3D line creation.

If this is on (checked), it will cause a (minimum) bend between the two lines automatically.  The radius of this minimum bend is in the document settings.  Go to Tools tab; Options panel; Document Settings; Sketch tab; and under the "3D Sketch" heading is textbox setting called "Auto-Bend Radius".  That is where you can specify what the minimum radius is that it will automatically insert when creating 3D lines, when that application option is turned on (checked).  Therefore, because that radius (bend) already exists, when you are trying to create another bend between the same two lines, it always either fails or shows an error message.  Try turning that application option off.

 

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click 'LIKE' 👍.

If you have time, please... Vote For My IDEAS :light_bulb:or you can Explore My CONTRIBUTIONS

Inventor 2021 Help | Inventor Forum | Inventor Customization Forum | Inventor Ideas Forum

Wesley Crihfield

EESignature

Message 6 of 8
WCrihfield
in reply to: WCrihfield

@EdHa, @daniel6QL3E 

When I manually set the value of that auto bend radius to "0.000 mm" in the Document Settings, Sketch tab, then run the rule like this:

(I had to comment out and replace a couple references in the original code to use it as a standalone 'Sub Main' instead of a referenced method with input variables.)

 

 

'Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Sub Main
	'add 3d sketchpoints in open partdoc
	Dim oPartDoc As PartDocument
	Dim oPartDef As PartComponentDefinition
	Dim oTG As TransientGeometry

'	oTG = _invApp.TransientGeometry
	oTG = ThisApplication.TransientGeometry
'	oPartDoc = _invApp.ActiveDocument
	oPartDoc = ThisApplication.ActiveDocument
'	oPartDoc.Sketch3DSettings.AutoBendRadius = "0.000 mm"
	oPartDef = oPartDoc.ComponentDefinition

	Dim oSketch As Sketch3D

	oSketch = oPartDef.Sketches3D.Add()

	Dim sp1(2) As SketchPoint3D
	Dim rod(1) As SketchLine3D

	sp1(0) = oSketch.SketchPoints3D.Add(oTG.CreatePoint(0, 0, 10))
	sp1(1) = oSketch.SketchPoints3D.Add(oTG.CreatePoint(0, 0, 0))
	sp1(2) = oSketch.SketchPoints3D.Add(oTG.CreatePoint(10, 0, 0))
	
'	ThisApplication.Sketch3DOptions.AutoBendWithLineCreation = False
	
	rod(0) = oSketch.SketchLines3D().AddByTwoPoints(sp1(0), sp1(1))
	rod(1) = oSketch.SketchLines3D().AddByTwoPoints(sp1(1), sp1(2))

	
	Try
		'bending it
		oSketch.SketchArcs3D.AddAsBend(rod(0), rod(1), "2.5 mm")
	Catch
		MsgBox("AddAsBend method failed.",,"")
	End Try
End Sub

'Private _invApp As Inventor.Application = ThisApplication

 

 

It works fine for me. (Inventor 2021.1)

 

If this solved your problem, or answered your question, please click ACCEPT SOLUTION.
Or, if this helped you, please click 'LIKE' 👍.

Wesley Crihfield

EESignature

Message 7 of 8
WCrihfield
in reply to: WCrihfield

I did however notice that when I turned off the application option manually (unchecked it then Apply), then ran the rule, it automatically reset the application option back to being on (checked).  Even when I turned that application option off within the code, just before creating the lines, then ran the rule, it still automatically turned that option back on for some reason.  Now that may be a Bug.  However, setting the document setting to zero seemed to do the trick for me, no matter how the application option was set.

Wesley Crihfield

EESignature

Message 8 of 8
daniel6QL3E
in reply to: EdHa

Hello WCrihfield,

 

Thank you very much for your answer. You seem to be right the problem is obviously the automatic radius. To turn that off you can also pass a parameter directly in the following code line:

 

Set rod(i) = oSketch.SketchLines3D().AddByTwoPoints(sp1(0), sp1(1), False)

 

This is how I will do it now.

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

Post to forums  

Autodesk Design & Make Report