Connect line points ( of cutout sketch ) to extrude

Creator
Creator

Hello,

 

I have drawn a extruded boss/base in a part. After that i want to add a cutout to the profile).

Normally i would use the addkeypoint command but I can't find a way to connect the endpoint of the line to a line of the extrude. The sketch is drawn at the mid plane and not at a face of the extrude. 

 

   Dim objRelations2d As SolidEdgeFrameworkSupport.Relations2d = Nothing
objRelations2d.AddKeypoint(L8, KeypointIndexConstants.igLineEnd, L5, KeypointIndexConstants.igLineStart)

This is an example of connecting 2 lines.

 

Thanks guys!

6 REPLIES

Re: Connect line points ( of cutout sketch ) to extrude

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

First get the edge from the extruded boss and include it in your cutout profile using the Profile.IncludeEdge() method.

Then, you can use it as a normal 2d profile geometry depending on the type of the projected curve.

Re: Connect line points ( of cutout sketch ) to extrude

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

Here is a sample of how to create a cutout including a line from the protrusion profile.

 

Spoiler
'----------------------------------------------------------------------
' PAR: Create a rectangular extruded base geometry and then add a triangular
'      cutout including one edge from the base geometry
'----------------------------------------------------------------------
Dim width As Double = 0.05 ' 50 mm
Dim depth As Double = 0.03 ' 30 mm
Dim height As Double = 0.06 ' 60 mm
'
Dim ww As Double = width / 2
Dim dd As Double = depth / 2
'
Dim objDoc As PartDocument = objApp.Documents.Add("SolidEdge.PartDocument")

' Switch to Ordered mode
objDoc.ModelingMode = ModelingModeConstants.seModelingModeOrdered

' Start a new profile on the TOP plane
Dim objTopPlane As SolidEdgePart.RefPlane = objDoc.RefPlanes.Item(1)
Dim objProfSets As SolidEdgePart.ProfileSets = objDoc.ProfileSets
Dim objProfSet As SolidEdgePart.ProfileSet = objProfSets.Add()
Dim objProf As SolidEdgePart.Profile = objProfSet.Profiles.Add(objTopPlane)

' Create the rectangular geometry
Dim L1 As SolidEdgeFrameworkSupport.Line2d = objProf.Lines2d.AddBy2Points(-ww, -dd, ww, -dd)
Dim L2 As SolidEdgeFrameworkSupport.Line2d = objProf.Lines2d.AddBy2Points(ww, -dd, ww, dd)
Dim L3 As SolidEdgeFrameworkSupport.Line2d = objProf.Lines2d.AddBy2Points(ww, dd, -ww, dd)
Dim L4 As SolidEdgeFrameworkSupport.Line2d = objProf.Lines2d.AddBy2Points(-ww, dd, -ww, -dd)

' Connect the end points of all lines
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)

' Get the curve object from the first line
Dim nCurves As Integer = 0
Dim objCurves As Object = Nothing
objProf.MapGeometryToCurves(L1, nCurves, objCurves)

' Close the profile and hide it
objProf.End(ProfileValidationType.igProfileClosed)
objProf.Visible = False

' Create the extruded protrusion
Dim profs() = New Object() {objProf}
Dim objModel As Model = objDoc.Models.AddFiniteExtrudedProtrusion(1, profs, igRight, height)

' Create a new triangular profile on a plane PARALLEL to the TOP plane
'Dim objProfSet As SolidEdgePart.ProfileSet = objProfSets.Add()
Dim objMidPlane As SolidEdgePart.RefPlane = objDoc.RefPlanes.AddParallelByDistance(objTopPlane, height / 2, ReferenceElementConstants.igNormalSide, Nothing, Nothing, True, False)
Dim objProfSet2 As SolidEdgePart.ProfileSet = objProfSets.Add()
Dim objProf2 As SolidEdgePart.Profile = objProfSet2.Profiles.Add(objMidPlane)
' I did not succeed to use the second parameter to get directly the included line!!
objProf2.IncludeEdge(objCurves(0))
' ..so try to find the latest Line object (we know, we included a line!!)
Dim L1a As SolidEdgeFrameworkSupport.Line2d = objProf2.Lines2d.Item(objProf2.Lines2d.Count)
Dim L6 As SolidEdgeFrameworkSupport.Line2d = objProf2.Lines2d.AddBy2Points(0, 0, -ww, -dd)
Dim L7 As SolidEdgeFrameworkSupport.Line2d = objProf2.Lines2d.AddBy2Points(0, 0, ww, -dd)
Dim objRels2 As SolidEdgeFrameworkSupport.Relations2d = objProf2.Relations2d
objRels2.AddKeypoint(L1a, SolidEdgeConstants.KeypointIndexConstants.igLineStart, L6, SolidEdgeConstants.KeypointIndexConstants.igLineEnd)
objRels2.AddKeypoint(L1a, SolidEdgeConstants.KeypointIndexConstants.igLineEnd, L7, SolidEdgeConstants.KeypointIndexConstants.igLineEnd)
objRels2.AddKeypoint(L6, SolidEdgeConstants.KeypointIndexConstants.igLineStart, L7, SolidEdgeConstants.KeypointIndexConstants.igLineStart)

' Close the profile and hide it
objProf2.End(ProfileValidationType.igProfileClosed)
objProf2.Visible = False

' Create the extruded cutout
objModel.ExtrudedCutouts.AddFinite(objProf2, igLeft, igSymmetric, height / 2)

Re: Connect line points ( of cutout sketch ) to extrude

Creator
Creator

As you can see in the pictures, i convert the lines. The arcs/fillets are making trouble for me. I can connect to the edge because the point there does not exist. With mates which i connect to these included lines, it only connects to the left and right side but not to the top side. I've tried multiple mates but collinear and keypoint mates are the only ones which work. But not at the proper way. 

 

I think the best way would be to include the lines of the extrude instead of the lines of the first drawn profile.

Spoiler
Dim nCurves As Integer = 0
Dim objCurves1 As Object = Nothing
Dim objCurves2 As Object = Nothing
Dim objCurves4 As Object = Nothing
Dim objcurvearc As Object = Nothing
Dim objcurvearc1 As Object = Nothing

objProfile.MapGeometryToCurves(L1, nCurves, objCurves1)
objProfile.MapGeometryToCurves(L2, nCurves, objCurves2)
objProfile.MapGeometryToCurves(L4, nCurves, objCurves4)
objProfile.MapGeometryToCurves(A1, nCurves, objcurvearc)
objProfile.MapGeometryToCurves(A2, nCurves, objcurvearc1)
Spoiler
                    Dim objMidPlane As SolidEdgePart.RefPlane = objPart.RefPlanes.AddParallelByDistance(objPart.RefPlanes.Item(plane), Lengte / 2, ReferenceElementConstants.igNormalSide, Nothing, Nothing, True, False)
                    Dim objProfSet2 As SolidEdgePart.ProfileSet = objProfileSets.Add()
                    Dim objProf2 As SolidEdgePart.Profile = objProfSet2.Profiles.Add(objMidPlane)

                    ' I did not succeed to use the second parameter to get directly the included line!!
                    objProf2.IncludeEdge(objCurves1(0))
                    objProf2.IncludeEdge(objCurves2(0))
                    objProf2.IncludeEdge(objCurves4(0))
                    'objProf2.IncludeEdge(objcurvearc(0))
                    'objProf2.IncludeEdge(objcurvearc1(0))

                    Dim L11a = objProf2.Lines2d.Item(objProf2.Lines2d.Count - 2)
                    Dim L11b = objProf2.Lines2d.Item(objProf2.Lines2d.Count - 1)
                    Dim L11c = objProf2.Lines2d.Item(objProf2.Lines2d.Count)

                    Dim L11 = objLines2d.AddBy2Points(Breedte, (Lengte / 2) - (Breedte * 2), -Breedte, (Lengte / 2)) '\
                    Dim L12 = objLines2d.AddBy2Points(Breedte, (Lengte / 2) - (Breedte * 2), Breedte, (Lengte / 2)) '|
                    Dim L13 = objLines2d.AddBy2Points(-Breedte, Lengte / 2, Breedte, Lengte / 2) '-

                    objRelations2d.AddKeypoint(L11, KeypointIndexConstants.igLineEnd, L12, KeypointIndexConstants.igLineStart)
                    objRelations2d.AddKeypoint(L12, KeypointIndexConstants.igLineEnd, L13, KeypointIndexConstants.igLineEnd)
                    objRelations2d.AddKeypoint(L13, KeypointIndexConstants.igLineStart, L11, KeypointIndexConstants.igLineStart)
                    objRelations2d.AddVertical(L12)
                    objRelations2d.AddHorizontal(L13)
                    objRelations2d.AddEqual(L12, L13)
                    objRelations2d.AddKeypoint(L13, KeypointIndexConstants.igLineEnd, L11b, KeypointIndexConstants.igLineEnd)
                    objRelations2d.AddKeypoint(L13, KeypointIndexConstants.igLineStart, L11c, KeypointIndexConstants.igLineStart)

Knipsel.JPGknipsel2.JPGknipsel3.JPG

I hope you guys can help me to fix this problem.

Re: Connect line points ( of cutout sketch ) to extrude

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

Sorry, but I did not force myself a lot trying to understand your explaination and I got lost of what are you going to do and where exactly your problem is?

 

Can you show some annotated images of how the result should look like (by e.g. manually creating the features) and what is the result of your current code with indications what is missing/failing?

Re: Connect line points ( of cutout sketch ) to extrude

Creator
Creator
I am trying to make the cutout sketch fully defined. And the only thing left to do is to connect the top line of the sketch of the cutout, to the top face.

Re: Connect line points ( of cutout sketch ) to extrude

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

Okay, so your problem is probably in the IncludeEdge() method.

As the line is perpendicular to your cutout profile, the projected geometry will be a point and NOT a line. Try to get the last point for the connect relation after including this edge.