2 Profiles in AddFiniteExtrudedProtrusion ( tube ) and fillet

Creator
Creator

Hello, i am having some problems, i have drawn 2 profiles, each profile works without the other one but when i want to make an extrude with the 2 profiles ( for a tube ), it won't work.

 

The best option is to make an offset of the first profile but i couldn't get it worked out yet.

 

I think that the array the problem is.

 

Also the fillet gives problems, I will explain that later on.

For the english people over here:

Breedte = width 

Hoogte = height

Dikte = thickness

Lengte = length

 

You can find the code in the spoiler tag.

 

Spoiler
       Else
            Dim objPart As SolidEdgePart.PartDocument = Nothing
            Dim objProfileSets As SolidEdgePart.ProfileSets = Nothing
        Dim objProfileSet As SolidEdgePart.ProfileSet = Nothing
        Dim objProfiles As SolidEdgePart.Profiles = Nothing
        Dim objProfile As SolidEdgePart.Profile = Nothing
        Dim objRefplanes As SolidEdgePart.RefPlanes = Nothing
        Dim objRelations2d As SolidEdgeFrameworkSupport.Relations2d = Nothing
        Dim objRelation2d As SolidEdgeFrameworkSupport.Relation2d = Nothing
        Dim objLines2d As SolidEdgeFrameworkSupport.Lines2d = Nothing
        Dim objLine2d As SolidEdgeFrameworkSupport.Line2d = Nothing
        Dim objarcs2d As SolidEdgeFrameworkSupport.Arcs2d = Nothing
        Dim objModels As SolidEdgePart.Models = Nothing
        Dim objModel As SolidEdgePart.Model = Nothing
        Dim aProfiles As Array

            ' Get a reference to the profile sets collection
            objPart = Main.SEApplication.ActiveDocument
        objProfileSets = objPart.ProfileSets
        ' Add a new profile set
        objProfileSet = objProfileSets.Add()
        ' Get a reference to the profiles collection
        objProfiles = objProfileSet.Profiles
        'Plane selecteren
        objRefplanes = objPart.RefPlanes
        If Opt__Top.Checked = True Then
            objProfile = objProfiles.Add(objRefplanes.Item(1))
        ElseIf Opt__Right.Checked = True Then
            objProfile = objProfiles.Add(objRefplanes.Item(2))
        ElseIf Opt__Front.Checked = True Then
            objProfile = objProfiles.Add(objRefplanes.Item(3))
        End If

            ' Get a reference to the lines2d collection
            objLines2d = objProfile.Lines2d
            ' Draw the Base Profile
            Dim Dikte = CDbl(TextBox_Wanddikte.Text / 2000) '/1000 voor naar meters en /2 ivm schetsen
            Dim Breedte = CDbl(TextBox_breedte.Text / 2000)
            Dim Hoogte = CDbl(TextBox_Hoogte.Text / 2000)
            Dim bBreedte = CDbl((Breedte - (0.5 * Dikte)))
            Dim Lengte = CDbl(TextBox_Lengte.Text / 2000)
            Dim bhoogte = CDbl((Hoogte - (0.5 * Dikte)))

            objLine2d = objLines2d.AddBy2Points(-Breedte, -Hoogte, Breedte, -Hoogte) 'lo naar ro
        objLine2d = objLines2d.AddBy2Points(Breedte, -Hoogte, Breedte, Hoogte) 'ro naar rb
        objLine2d = objLines2d.AddBy2Points(Breedte, Hoogte, -Breedte, Hoogte) 'rb naar lb
        objLine2d = objLines2d.AddBy2Points(-Breedte, Hoogte, -Breedte, -Hoogte) 'lb naar lo
        'Define Relations among the Line objects to make the Profile closed
        objRelations2d = objProfile.Relations2d
        objRelations2d.AddKeypoint(objLines2d.Item(1), KeypointIndexConstants.igLineEnd, objLines2d.Item(2), KeypointIndexConstants.igLineStart)
        objRelations2d.AddKeypoint(objLines2d.Item(2), KeypointIndexConstants.igLineEnd, objLines2d.Item(3), KeypointIndexConstants.igLineStart)
        objRelations2d.AddKeypoint(objLines2d.Item(3), KeypointIndexConstants.igLineEnd, objLines2d.Item(4), KeypointIndexConstants.igLineStart)
        objRelations2d.AddKeypoint(objLines2d.Item(4), KeypointIndexConstants.igLineEnd, objLines2d.Item(1), KeypointIndexConstants.igLineStart)
        objRelations2d.AddHorizontal(objLines2d.Item(1))
        objRelations2d.AddVertical(objLines2d.Item(2))
        objRelations2d.AddHorizontal(objLines2d.Item(3))
        objRelations2d.AddVertical(objLines2d.Item(4))
            ' Close the profile
            objProfile.End(SolidEdgePart.ProfileValidationType.igProfileClosed)
            If Opt__Top.Checked = True Then
                objProfile = objProfiles.Add(objRefplanes.Item(1))
            ElseIf Opt__Right.Checked = True Then
                objProfile = objProfiles.Add(objRefplanes.Item(2))
            ElseIf Opt__Front.Checked = True Then
                objProfile = objProfiles.Add(objRefplanes.Item(3))
            End If

            'insideprofile
            objLine2d = objLines2d.AddBy2Points(-bBreedte, -bhoogte, bBreedte, -bhoogte) 'lo naar ro
            objLine2d = objLines2d.AddBy2Points(bBreedte, -bhoogte, bBreedte, bhoogte) 'ro naar rb
            objLine2d = objLines2d.AddBy2Points(bBreedte, bhoogte, -bBreedte, bhoogte) 'rb naar lb
            objLine2d = objLines2d.AddBy2Points(-bBreedte, bhoogte, -bBreedte, -bhoogte) 'lb naar lo
            'Define Relations among the Line objects to make the Profile closed
            objRelations2d.AddKeypoint(objLines2d.Item(5), KeypointIndexConstants.igLineEnd, objLines2d.Item(6), KeypointIndexConstants.igLineStart)
            objRelations2d.AddKeypoint(objLines2d.Item(6), KeypointIndexConstants.igLineEnd, objLines2d.Item(7), KeypointIndexConstants.igLineStart)
            objRelations2d.AddKeypoint(objLines2d.Item(7), KeypointIndexConstants.igLineEnd, objLines2d.Item(8), KeypointIndexConstants.igLineStart)
            objRelations2d.AddKeypoint(objLines2d.Item(8), KeypointIndexConstants.igLineEnd, objLines2d.Item(5), KeypointIndexConstants.igLineStart)
            objRelations2d.AddHorizontal(objLines2d.Item(5))
            objRelations2d.AddVertical(objLines2d.Item(6))
            objRelations2d.AddHorizontal(objLines2d.Item(7))
            objRelations2d.AddVertical(objLines2d.Item(8))

            ' Close the profile
            objProfile.End(SolidEdgePart.ProfileValidationType.igProfileClosed)
        ' Hide the profile
        objProfile.Visible = False
        ' Create a new array of profile objects
        aProfiles = Array.CreateInstance(GetType(SolidEdgePart.Profile), 1)
        aProfiles.SetValue(objProfile, 0)
            ' Get a reference to the models collection
            objModels = objPart.Models
            ' Create the extended protrusion.

            objModel = objModels.AddFiniteExtrudedProtrusion(aProfiles.Length, aProfiles, SolidEdgePart.FeaturePropertyConstants.igLeft, Lengte)
 
6 REPLIES

Re: 2 Profiles in AddFiniteExtrudedProtrusion ( tube )

Solution Partner Legend Solution Partner Legend
Solution Partner Legend

Hi,

without a deeper look, you say your protrusion requires 2 profiles, but you're adding just one to aProfiles. Might this cause the error?

Kind regards,
Wolfgang Kunert - www.wksyspro.de

Re: 2 Profiles in AddFiniteExtrudedProtrusion ( tube )

Creator
Creator

It can be, but i don't really know how the arrays exactly work. So how can i start a new profile, add this one to a profile and how do i extrude both profiles/array??

Re: 2 Profiles in AddFiniteExtrudedProtrusion ( tube )

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

The first thing I saw in your code was the profile end condition (igProfileClosed), which only allows to use a single closed curve (+ construction) on your profile.

For multiple profiles, you should use the igProfileAllowNested condition (see my code below).

 

EDIT: It is NOT required to use multiple Profile objects!! SE automatically identifies the internal and external areas of the material side.

 

'----------------------------------------------------------------------
' PAR: Create a protrusion from a rectangular hollow profile
'----------------------------------------------------------------------
Dim objDoc As PartDocument = objApp.ActiveDocument
objDoc.ModelingMode = ModelingModeConstants.seModelingModeOrdered
Dim objProfSets As SolidEdgePart.ProfileSets = objDoc.ProfileSets
Dim objProfSet As SolidEdgePart.ProfileSet = objProfSets.Add()
Dim objProf As SolidEdgePart.Profile = objProfSet.Profiles.Add(objDoc.RefPlanes.Item(1))
' Create the external rectangle
Dim L1 As SolidEdgeFrameworkSupport.Line2d = objProf.Lines2d.AddBy2Points(-0.05, -0.1, 0.05, -0.1)
Dim L2 As SolidEdgeFrameworkSupport.Line2d = objProf.Lines2d.AddBy2Points(0.05, -0.1, 0.05, 0.1)
Dim L3 As SolidEdgeFrameworkSupport.Line2d = objProf.Lines2d.AddBy2Points(0.05, 0.1, -0.05, 0.1)
Dim L4 As SolidEdgeFrameworkSupport.Line2d = objProf.Lines2d.AddBy2Points(-0.05, 0.1, -0.05, -0.1)
Dim objRels As SolidEdgeFrameworkSupport.Relations2d = objProf.Relations2d
objRels.AddKeypoint(L1, SolidEdgeConstants.KeypointIndexConstants.igLineEnd, L2, SolidEdgeConstants.KeypointIndexConstants.igLineStart)
objRels.AddKeypoint(L2, SolidEdgeConstants.KeypointIndexConstants.igLineEnd, L3, SolidEdgeConstants.KeypointIndexConstants.igLineStart)
objRels.AddKeypoint(L3, SolidEdgeConstants.KeypointIndexConstants.igLineEnd, L4, SolidEdgeConstants.KeypointIndexConstants.igLineStart)
objRels.AddKeypoint(L4, SolidEdgeConstants.KeypointIndexConstants.igLineEnd, L1, SolidEdgeConstants.KeypointIndexConstants.igLineStart)
' Create the inner rectangle
L1 = objProf.Lines2d.AddBy2Points(-0.047, -0.097, 0.047, -0.097)
L2 = objProf.Lines2d.AddBy2Points(0.047, -0.097, 0.047, 0.097)
L3 = objProf.Lines2d.AddBy2Points(0.047, 0.097, -0.047, 0.097)
L4 = objProf.Lines2d.AddBy2Points(-0.047, 0.097, -0.047, -0.097)
objRels.AddKeypoint(L1, SolidEdgeConstants.KeypointIndexConstants.igLineEnd, L2, SolidEdgeConstants.KeypointIndexConstants.igLineStart)
objRels.AddKeypoint(L2, SolidEdgeConstants.KeypointIndexConstants.igLineEnd, L3, SolidEdgeConstants.KeypointIndexConstants.igLineStart)
objRels.AddKeypoint(L3, SolidEdgeConstants.KeypointIndexConstants.igLineEnd, L4, SolidEdgeConstants.KeypointIndexConstants.igLineStart)
objRels.AddKeypoint(L4, SolidEdgeConstants.KeypointIndexConstants.igLineEnd, L1, SolidEdgeConstants.KeypointIndexConstants.igLineStart)
' Close the profile
objProf.End(ProfileValidationType.igProfileAllowNested)
' Hide all profiles (SE automatically creates a Profile object for each closed profile)
For Each objProf In objProfSet.Profiles
  objProf.Visible = False
Next
' Only pass the first profile to the AddFiniteExtrudedProtrusion method
Dim profs() = New Object() {objProf}
objDoc.Models.AddFiniteExtrudedProtrusion(1, profs, igLeft, 0.8)

 

Highlighted

Re: 2 Profiles in AddFiniteExtrudedProtrusion ( tube )

Creator
Creator

It seems to work, ( the extrude ) i will go on with trying to get the fillet in the sketch! Thanks!

Re: 2 Profiles in AddFiniteExtrudedProtrusion ( tube )

Creator
Creator

Hello,

 

I've managed it to make the tube like i want ( see the picture )

 

tube.JPG

I'm also trying to get the fillet in the sketch and the sketching worked ( see second picture )

fillet.JPG

with this code: 

 

 Dim objLine1 = objLines2d.AddBy2Points(-Breedte, -Hoogte, Breedte - (0.5 * dikte), -Hoogte)
 Dim objline2 = objLines2d.AddBy2Points(Breedte, -Hoogte + (dikte * 0.5), Breedte, Hoogte) 
 Dim plane = 2
 ' Create an Arcs collection object
        objProfile = objProfiles.Add(objRefplanes.Item(plane))
        objArcs = objProfile.Arcs2d
        Dim Fillet1 = objArcs.AddAsFillet(objLine1, objline2, Radius, xDirection:=-1, yDirection:=1)
       
 objRelations2d = objProfile.Relations2d
       objRelations2d.AddKeypoint(objLine1, KeypointIndexConstants.igLineEnd, Fillet1, KeypointIndexConstants.igArcEnd)

The error occurs at the last sentence and i think that i can't connect a line to an arc with keypointconstants.igArcEnd or igArcStart

 

Re: 2 Profiles in AddFiniteExtrudedProtrusion ( tube )

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

For the fillet, you don't need to add the additional relations. The fillet relation already includes connection and tangency to its attached geometry.

AND:

You should first create the closed rectangle and then add the fillet to the closed and connected corners, like you would do manually ;-)