Register  Login   Search
 Latest Posts Minimize

RE: Remove unused Linestyles
Solid Edge Programming
09/03/2010 7:45 AM
jr199

Remove unused Linestyles
Solid Edge Programming
09/02/2010 1:25 PM
kmwolf

How to read block in a dft file without opening the dft file?
Solid Edge Programming
09/02/2010 9:02 AM
assassin.007

Inquire Element - Measure Diameter by VBA
Solid Edge Programming
09/02/2010 6:40 AM
JM

dissolve Reference to SubASM - how to??
Solid Edge Programming
09/02/2010 2:23 AM
LIHE

RE: Using Insight on a 64 bit Computer
Solid Edge General
08/31/2010 7:47 AM
Atom

Using Insight on a 64 bit Computer
Solid Edge General
08/30/2010 3:06 PM
Atom

RE: File Properties using VB.NET leave file locked
Solid Edge Programming
08/30/2010 9:57 AM
JBZ

RE: File Properties using VB.NET leave file locked
Solid Edge Programming
08/30/2010 3:20 AM
jr199

File Properties using VB.NET leave file locked
Solid Edge Programming
08/27/2010 4:36 PM
JBZ

RE: XLS link to the part
Solid Edge Programming
08/27/2010 4:11 PM
JBZ

RE: Save As for each view -- how 2 wait for SE !
Solid Edge Programming
08/27/2010 3:27 AM
jr199

vb6 se20 - solid edge Part - Hole size
Solid Edge Programming
08/26/2010 9:42 PM
cadraw

vb6 se20 - how to Drawing View Depth
Solid Edge Programming
08/26/2010 9:24 PM
cadraw

RE: Problem while getting the objects using "SelectSet" property.
Solid Edge Programming
08/26/2010 7:35 AM
jr199

RE: About the "Callout"!
Solid Edge Programming
08/26/2010 3:42 AM
fatkids

RE: Save As for each view -- how 2 wait for SE !
Solid Edge Programming
08/25/2010 3:28 AM
ErWo

RE: help to transfer C# codes as following to C++ codes?
Solid Edge Programming
08/24/2010 10:12 PM
assassin.007

RE: FamilyMembers Panel problem (refreshing)
Solid Edge Programming
08/24/2010 3:47 PM
peter6396

Save As for each view -- how 2 wait for SE !
Solid Edge Programming
08/24/2010 4:09 AM
LIHE

RE: FamilyMembers Panel problem (refreshing)
Solid Edge Programming
08/24/2010 1:28 AM
ErWo

help to transfer C# codes as following to C++ codes?
Solid Edge Programming
08/23/2010 10:34 PM
assassin.007

Problem while getting the objects using "SelectSet" property.
Solid Edge Programming
08/22/2010 7:59 AM
pratap

FamilyMembers Panel problem (refreshing)
Solid Edge Programming
08/20/2010 4:12 AM
peter6396

RE: AddLoftedFlange in SheetMetal
Solid Edge Programming
08/19/2010 4:33 AM
jason.newell

RE: PartList Positioning
Solid Edge Programming
08/19/2010 2:10 AM
ErWo

RE: Alternate Assemblies
Solid Edge Programming
08/18/2010 4:54 PM
peter6396

RE: About the "Callout"!
Solid Edge Programming
08/18/2010 7:39 AM
Danisan

XLS link to the part
Solid Edge Programming
08/18/2010 5:23 AM
romanes

About the "Callout"!
Solid Edge Programming
08/17/2010 2:49 AM
fatkids


  
 Forums Minimize

Subject: Help with SweptProtrusion
Prev Next
You are not authorized to post a reply.

Author Messages
stonelydUser is Offline
New Member
New Member
Posts:2

01/19/2010 10:37 AM  

Hi,

I am looking for help with SweptProtrusion API. I am trying to do this with a SyncPart, but working example in a traditional part would be great.


 Private Sub Command1_Click()
    Dim objApp As SolidEdgeFramework.Application
    Dim objPart As SolidEdgePartSync.PartDocument
    Dim objRefPlanes As SolidEdgePartSync.RefPlanes
    Dim objRefPlane As SolidEdgePartSync.RefPlane
    Dim objSketches As SolidEdgePartSync.Sketchs
    Dim objSketch As SolidEdgePartSync.Sketch
    Dim objProfiles As SolidEdgePartSync.Profiles
    Dim objProfile As SolidEdgePartSync.Profile
    Dim objLines2d As SolidEdgeFrameworkSupport.Lines2d
    Dim objLine2d As SolidEdgeFrameworkSupport.Line2d
    Dim objPoints2d As SolidEdgeFrameworkSupport.Points2d
    Dim objPoint2d As SolidEdgeFrameworkSupport.Point2d
   
    Dim objRefPlaneNormal As SolidEdgePartSync.RefPlane
    Dim objSketchCS As SolidEdgePartSync.Sketch
    Dim objProfileCS As SolidEdgePartSync.Profile
    Dim objLines2dCS As SolidEdgeFrameworkSupport.Lines2d
   
    Dim lngTraceCurveTypes(1 To 2) As Long
    Dim lngCrossSectionTypes(1 To 2) As Long
    Dim vOriginArray(2) As Variant

    Dim TraceCurveSet(1) As Object
    Dim EdgeSet(1 To 4) As Object
   
    Dim objModel As SolidEdgePartSync.Model
   
  
    Dim X1 As Double
    Dim Y1 As Double
    Dim X2 As Double
    Dim Y2 As Double
    Dim Z As Double
   
    Dim xx As Double
    Dim yy As Double
   
    Const WIDTH As Double = 0.01
    Const HEIGTH As Double = 0.02
   
    X1 = 0.1
    Y1 = 0
    X2 = 0.1
    Y2 = 0.1
    Z = 0.1

   
    ' Connect to a running instance of Solid Edge
    Set objApp = GetObject(, "SolidEdge.Application")
    ' Create a new part document
    Set objPart = objApp.Documents.Add("SolidEdge.DMPartDocument")
    ' Get a reference to the ref planes collection
    Set objRefPlanes = objPart.RefPlanes
   
    ' Get a reference to the sketches collection
    Set objSketches = objPart.Sketches
   
   

    Set objRefPlane = objRefPlanes.AddParallelByDistance(objRefPlanes(0), Z, SolidEdgePartSync.ReferenceElementConstants.igNormalSide, , , False)
    Set objSketch = objSketches.AddByPlanarFace(objRefPlane)
    Set objProfile = objSketch.Profile
    Set objLines2d = objProfile.Lines2d
    Set objLine2d = objLines2d.AddBy2Points(X1, Y1, X2, Y2)
   
    Set objRefPlaneNormal = objRefPlanes.AddNormalToCurve(objProfile.CurveBody.Curves(1), igCurveStart, objRefPlanes(0), igPivotStart, False)
           
    Set objSketchCS = objSketches.AddByPlanarFace(objRefPlaneNormal)
    Set objProfileCS = objSketchCS.Profile
    Set objLines2dCS = objProfileCS.Lines2d
   
    Call objProfileCS.Convert3DCoordinate(X1, Y1, Z, xx, yy)
   
    xx = xx - (WIDTH / 2)
   
    With objLines2dCS
        .AddBy2Points xx, yy, xx + WIDTH, yy
        .AddBy2Points xx + WIDTH, yy, xx + WIDTH, yy - HEIGTH ' 2mm deep
        .AddBy2Points xx + WIDTH, yy - HEIGTH, xx, yy - HEIGTH
        .AddBy2Points xx, yy - HEIGTH, xx, yy
    End With
   
   
    lngTraceCurveTypes(1) = igProfileBasedCrossSection
    lngCrossSectionTypes(1) = igProfileBasedCrossSection
    vOriginArray(1) = 0

    Set EdgeSet(1) = objProfile.CurveBody.Curves(1)
    Set EdgeSet(2) = objProfile.CurveBody.Curves(2)
    Set EdgeSet(3) = objProfile.CurveBody.Curves(3)
    Set EdgeSet(4) = objProfile.CurveBody.Curves(3)


    Set TraceCurveSet(1) = objProfile.CurveBody.Curves(1)
   
 
'' This didnt work either

'    Set objModel = objPart.Models.AddSweptProtrusion(1, TraceCurveSet, lngTraceCurveTypes, 1, EdgeSet, lngCrossSectionTypes, vOriginArray, 0, igLeft, igNone, 0, Nothing, igNone, 0, Nothing)
   
'' Not how to struture all these parameters

    Set objModel = objPart.Models.AddSweptProtrusion(1, objProfile, lngTraceCurveTypes, 1, objProfileCS, lngCrossSectionTypes, vOriginArray, 0, igLeft, igNone, 0, Nothing, igNone, 0, Nothing)

   
   
    Set objApp = Nothing
    Set objPart = Nothing
    Set objRefPlanes = Nothing
    Set objSketches = Nothing

        Set objRefPlane = Nothing
        Set objSketch = Nothing
        Set objProfiles = Nothing
        Set objProfile = Nothing
        Set objLines2d = Nothing
        Set objLine2d = Nothing
        Set objPoints2d = Nothing
        Set objPoint2d = Nothing
'        Set edgeSet = Nothing

    Set objRefPlaneNormal = Nothing
   
    Set objRefPlaneNormal = Nothing
    Set objSketchCS = Nothing
    Set objProfileCS = Nothing
    Set objLines2dCS = Nothing
 
    Set TraceCurveSet(0) = Nothing
    Set TraceCurveSet(1) = Nothing
   
    For i = 1 To 4
        Set EdgeSet(i) = Nothing
    Next i

    Set objModel = Nothing

   
End Sub

Julian GuilloUser is Offline
SE Guru
Site Member
Site Member
Posts:105

01/19/2010 11:14 AM  

I found an old example i did for someone else in the SE programming newsgroup.

Find it attached.

Regards,

Julian


Attachment: 1119142597971.zip

stonelydUser is Offline
New Member
New Member
Posts:2

01/19/2010 2:47 PM  

Julian,

Thanks for the help. Your example had enough hints to help me out.

David

 

Here is my functional Code for searchers

 Private Sub Command1_Click()
    Dim objApp As SolidEdgeFramework.Application
    Dim objPart As SolidEdgePartSync.PartDocument
    Dim objRefPlanes As SolidEdgePartSync.RefPlanes
    Dim objRefPlane As SolidEdgePartSync.RefPlane
    Dim objSketches As SolidEdgePartSync.Sketchs
    Dim objSketch As SolidEdgePartSync.Sketch
    Dim objProfiles As SolidEdgePartSync.Profiles
    Dim objProfile As SolidEdgePartSync.Profile
    Dim objLines2d As SolidEdgeFrameworkSupport.Lines2d
    Dim objLine2d As SolidEdgeFrameworkSupport.Line2d
    Dim objPoints2d As SolidEdgeFrameworkSupport.Points2d
    Dim objPoint2d As SolidEdgeFrameworkSupport.Point2d
   
    Dim objRefPlaneNormal As SolidEdgePartSync.RefPlane
    Dim objSketchCS As SolidEdgePartSync.Sketch
    Dim objProfileCS As SolidEdgePartSync.Profile
    Dim objLines2dCS As SolidEdgeFrameworkSupport.Lines2d
   
    Dim lngTraceCurveTypes(1 To 1) As Long
    Dim lngCrossSectionTypes(1 To 1) As Long
    Dim vOriginArray(1 To 1) As Variant

    Dim TraceCurveSet(1 To 1) As Object
    Dim EdgeSet(1 To 1) As Object
   
    Dim objModel As SolidEdgePartSync.Model
   
  
    Dim X1 As Double
    Dim Y1 As Double
    Dim X2 As Double
    Dim Y2 As Double
    Dim Z As Double
   
    Dim xx As Double
    Dim yy As Double
   
    Const WIDTH As Double = 0.01
    Const HEIGTH As Double = 0.02
   
    X1 = 0.1
    Y1 = 0
    X2 = 0.1
    Y2 = 0.1
    Z = 0.1

   
    ' Connect to a running instance of Solid Edge
    Set objApp = GetObject(, "SolidEdge.Application")
    ' Create a new part document
    Set objPart = objApp.Documents.Add("SolidEdge.DMPartDocument")
    ' Get a reference to the ref planes collection
    Set objRefPlanes = objPart.RefPlanes
   
    ' Get a reference to the sketches collection
    Set objSketches = objPart.Sketches
    
   

    Set objRefPlane = objRefPlanes.AddParallelByDistance(objRefPlanes(0), Z, SolidEdgePartSync.ReferenceElementConstants.igNormalSide, , , False)
    Set objSketch = objSketches.AddByPlanarFace(objRefPlane)
    Set objProfile = objSketch.Profile
    Set objLines2d = objProfile.Lines2d
    Set objLine2d = objLines2d.AddBy2Points(X1, Y1, X2, Y2)
    objProfile.End igProfileClosed
   
    Set objRefPlaneNormal = objRefPlanes.AddNormalToCurve(objProfile.CurveBody.Curves(1), igCurveStart, objRefPlanes(0), igPivotStart, False)
           
    Set objSketchCS = objSketches.AddByPlanarFace(objRefPlaneNormal)
    Set objProfileCS = objSketchCS.Profile
    Set objLines2dCS = objProfileCS.Lines2d
   
    Call objProfileCS.Convert3DCoordinate(X1, Y1, Z, xx, yy)
   
    xx = xx - (WIDTH / 2)
   
    With objLines2dCS
        .AddBy2Points xx, yy, xx + WIDTH, yy
        .AddBy2Points xx + WIDTH, yy, xx + WIDTH, yy - HEIGTH ' 2mm deep
        .AddBy2Points xx + WIDTH, yy - HEIGTH, xx, yy - HEIGTH
        .AddBy2Points xx, yy - HEIGTH, xx, yy
    End With
   
    objProfileCS.End igProfileClosed
   
    lngTraceCurveTypes(1) = igProfileBasedCrossSection
    lngCrossSectionTypes(1) = igProfileBasedCrossSection
    vOriginArray(1) = 0

    Set EdgeSet(1) = objProfileCS

    Set TraceCurveSet(1) = objProfile
   
    Set objModel = objPart.Models.AddSweptProtrusion(1, TraceCurveSet, lngTraceCurveTypes, 1, EdgeSet, lngCrossSectionTypes, vOriginArray, 0, igLeft, igNone, 0, Nothing, igNone, 0, Nothing)
   
   
    Set objApp = Nothing
    Set objPart = Nothing
    Set objRefPlanes = Nothing
    Set objSketches = Nothing

        Set objRefPlane = Nothing
        Set objSketch = Nothing
        Set objProfiles = Nothing
        Set objProfile = Nothing
        Set objLines2d = Nothing
        Set objLine2d = Nothing
        Set objPoints2d = Nothing
        Set objPoint2d = Nothing
'        Set edgeSet = Nothing

    Set objRefPlaneNormal = Nothing
   
    Set objRefPlaneNormal = Nothing
    Set objSketchCS = Nothing
    Set objProfileCS = Nothing
    Set objLines2dCS = Nothing
 
    Set TraceCurveSet(1) = Nothing
   

        Set EdgeSet(1) = Nothing


    Set objModel = Nothing

   

   
End Sub

 

You are not authorized to post a reply.
Forums > Solid Edge > Programming > Help with SweptProtrusion



ActiveForums 3.7

  

 Users Online Minimize

Membership Membership:
Latest New User Latest: jbazaar
New Today New Today: 1
New Yesterday New Yesterday: 3
User Count Overall: 1968

People Online People Online:
Visitors Visitors: 0
Members Members: 0
Total Total: 0

Online Now Online Now:

  

The Code Project

Spatial Freedom Astroid

Use OpenDNS

Copyright 2010 JasonNewell.NET   Terms Of Use  Privacy Statement