Register  Login   Search
 Latest Posts Minimize

RE: Through the program to create a square tube???
Solid Edge Programming
03/10/2010 2:58 AM
fatkids

RE: .Net: print of dwg files as pdf scaling problem
Solid Edge Programming
03/09/2010 3:55 AM
wksyspro

SEpartX crashs VB6
Solid Edge Programming
03/08/2010 8:38 AM
ara

Assembly instances not supported
Solid Edge General
03/07/2010 8:10 PM
cadourian

RE: .Net: print of dwg files as pdf scaling problem
Solid Edge Programming
03/06/2010 2:44 PM
tirolerover40

RE: .Net: print of dwg files as pdf scaling problem
Solid Edge Programming
03/06/2010 4:06 AM
wksyspro

RE: .Net: print of dwg files as pdf scaling problem
Solid Edge Programming
03/05/2010 2:35 PM
tirolerover40

RE: .Net: print of dwg files as pdf scaling problem
Solid Edge Programming
03/05/2010 11:36 AM
wksyspro

How to add menu to the QuickAccessToolbar
Solid Edge Programming
03/05/2010 4:57 AM
TomasV

Save sketched profile
Solid Edge Programming
03/04/2010 9:42 AM
Autoit

Use Isotable.dll with ST2 64bits
Solid Edge Programming
03/04/2010 7:22 AM
sinex

.Net: print of dwg files as pdf scaling problem
Solid Edge Programming
03/03/2010 3:03 PM
tirolerover40

How to get the threadFeature information from CopiedPart?
Solid Edge Programming
03/01/2010 5:36 AM
Julia

RE: How to read, from a draft, the file properties of the part / assembly
Solid Edge Programming
02/26/2010 8:18 AM
mdrummond

Assy Oeration Property
Solid Edge Programming
02/26/2010 8:13 AM
mdrummond

How the expansion of the Engineering Reference?
Solid Edge Programming
02/25/2010 8:35 PM
fatkids

RE: problems with creating toolbar
Solid Edge Programming
02/25/2010 11:39 AM
Nika_Neugier

Crash editing blocklabeloccurrence value
Solid Edge Programming
02/25/2010 2:55 AM
Tymen

problems with creating toolbar
Solid Edge Programming
02/24/2010 5:43 AM
Nika_Neugier

RE: Convert .dft to .dxf
Solid Edge Programming
02/23/2010 1:11 PM
jvelasco

RE: Internal Error: Invalid Status 0x248
Solid Edge General
02/22/2010 8:46 AM
catamayo

how to get mouse click event of the view of the SEPreview.ocx
Solid Edge Programming
02/21/2010 7:29 PM
wei

how to use the SEPreview.ocx
Solid Edge Programming
02/20/2010 2:41 AM
wei

Solid Edge / Insight BOM Extraction
Solid Edge Programming
02/18/2010 9:14 AM
alspaughja

How to set FaceStyle for face in occurrence?
Solid Edge Programming
02/18/2010 1:08 AM
jurajjoob

How to set Occurrence.FaceStyle to (Use Part Style) or (None)?
Solid Edge Programming
02/17/2010 2:42 PM
jurajjoob

RE: Exception when calling....
Solid Edge Programming
02/17/2010 8:03 AM
boman

Edit occurrence in place
Solid Edge Programming
02/17/2010 5:35 AM
Tymen

Getting part surface from assembly surface
Solid Edge Programming
02/16/2010 3:18 AM
Serge

RE: Need basic CNC info please
Solid Edge General
02/16/2010 12:20 AM
jr199


  
 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:95

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: simoned
New Today New Today: 0
New Yesterday New Yesterday: 5
User Count Overall: 1779

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

Online Now Online Now:

  

Siemens PLM Connection

JasonNewell.NET on Facebook

The Code Project

Spatial Freedom Astroid

Use OpenDNS

Copyright 2008 JasonNewell.NET   Terms Of Use  Privacy Statement