static void CreateExtrudedProtrusion(SolidEdgePart.SheetMetalDocument sheetMetalDocument) { SolidEdgePart.RefPlanes refPlanes = null; SolidEdgePart.RefPlane refPlane = null; SolidEdgePart.Sketchs sketchs = null; SolidEdgePart.Sketch sketch = null; SolidEdgePart.Profiles profiles = null; SolidEdgePart.Profile profile = null; SolidEdgeFrameworkSupport.Circles2d circles2d = null; SolidEdgeFrameworkSupport.Circle2d circle2d = null; SolidEdgePart.Models models = null; SolidEdgePart.Model model = null; // Get refplane. refPlanes = sheetMetalDocument.RefPlanes; refPlane = refPlanes.Item(2); // Create sketch. sketchs = sheetMetalDocument.Sketches; sketch = sketchs.Add(); // Create profile. profiles = sketch.Profiles; profile = profiles.Add(refPlane); // Create 2D circle. circles2d = profile.Circles2d; circle2d = circles2d.AddByCenterRadius(0, 0, 0.05); profile.Visible = false; // Create extruded protrusion. models = sheetMetalDocument.Models; model = models.AddBaseTab(profile, SolidEdgePart.FeaturePropertyConstants.igRight); }
static void Main(string[] args) { SolidEdgeFramework.Application application = null; SolidEdgeFramework.Documents documents = null; SolidEdgeDraft.DraftDocument draftDocument = null; SolidEdgeDraft.Sheet sheet = null; SolidEdgeFrameworkSupport.Circles2d circles2d = null; SolidEdgeFrameworkSupport.Circle2d circle2d = null; SolidEdgeFrameworkSupport.Dimensions dimensions = null; try { // Register with OLE to handle concurrency issues on the current thread. SolidEdgeCommunity.OleMessageFilter.Register(); // Connect to or start Solid Edge. application = SolidEdgeCommunity.SolidEdgeUtils.Connect(true, true); // Get a reference to the documents collection. documents = application.Documents; // Create a new draft document. draftDocument = documents.AddDraftDocument(); // Get a reference to the active sheet. sheet = draftDocument.ActiveSheet; // Get a reference to the Circles2d collection. circles2d = sheet.Circles2d; // Get a reference to the Dimensions collection. dimensions = (SolidEdgeFrameworkSupport.Dimensions)sheet.Dimensions; double x = 0.1; double y = 0.1; double radius = 0.01; for (int i = 0; i < 5; i++) { // Add the circle. circle2d = circles2d.AddByCenterRadius(x, y, radius); // Dimension the circle. dimensions.AddRadialDiameter(circle2d); x += 0.05; y += 0.05; radius += 0.01; } } catch (System.Exception ex) { Console.WriteLine(ex.Message); } finally { SolidEdgeCommunity.OleMessageFilter.Unregister(); } }
static void Main(string[] args) { SolidEdgeFramework.Application application = null; SolidEdgeFramework.Documents documents = null; SolidEdgeDraft.DraftDocument draftDocument = null; SolidEdgeDraft.Sheet sheet = null; SolidEdgeFrameworkSupport.Circles2d circles2d = null; SolidEdgeFrameworkSupport.Circle2d circle2d = null; SolidEdgeFrameworkSupport.GeometryStyle2d geometryStyle2d = null; try { // Register with OLE to handle concurrency issues on the current thread. SolidEdgeCommunity.OleMessageFilter.Register(); // Connect to or start Solid Edge. application = SolidEdgeCommunity.SolidEdgeUtils.Connect(true, true); // Get a reference to the Documents collection. documents = application.Documents; // Create a new draft document. draftDocument = documents.AddDraftDocument(); // Get a reference to the active sheet. sheet = draftDocument.ActiveSheet; // Get a reference to the Circles2d collection. circles2d = sheet.Circles2d; // Add the circle. circle2d = circles2d.AddByCenterRadius(0.2, 0.2, 0.1); // Get a reference to the GeometryStyle2d to modify the style. geometryStyle2d = circle2d.Style; } catch (System.Exception ex) { Console.WriteLine(ex.Message); } finally { SolidEdgeCommunity.OleMessageFilter.Unregister(); } }
public static SolidEdgePart.Model CreateBaseTabByCircle(SolidEdgePart.SheetMetalDocument sheetMetalDocument) { SolidEdgePart.RefPlanes refPlanes = null; SolidEdgePart.RefPlane refPlane = null; SolidEdgePart.Sketchs sketchs = null; SolidEdgePart.Sketch sketch = null; SolidEdgePart.Profiles profiles = null; SolidEdgePart.Profile profile = null; SolidEdgeFrameworkSupport.Circles2d circles2d = null; SolidEdgeFrameworkSupport.Circle2d circle2d = null; SolidEdgePart.Models models = null; SolidEdgePart.Model model = null; double x = 0; double y = 0; double radius = 0.05; // Get refplane. refPlanes = sheetMetalDocument.RefPlanes; // Get a reference to front RefPlane. refPlane = refPlanes.GetFrontPlane(); // Create sketch. sketchs = sheetMetalDocument.Sketches; sketch = sketchs.Add(); // Create profile. profiles = sketch.Profiles; profile = profiles.Add(refPlane); // Create 2D circle. circles2d = profile.Circles2d; circle2d = circles2d.AddByCenterRadius(x, y, radius); // Hide profile. profile.Visible = false; // Create extruded protrusion. models = sheetMetalDocument.Models; model = models.AddBaseTab(profile, SolidEdgePart.FeaturePropertyConstants.igRight); return(model); }
static void Main(string[] args) { SolidEdgeFramework.Application application = null; SolidEdgeFramework.Documents documents = null; SolidEdgePart.PartDocument partDocument = null; SolidEdgePart.RefPlanes refPlanes = null; SolidEdgePart.RefPlane refPlane = null; SolidEdgePart.Sketchs sketches = null; SolidEdgePart.Sketch sketch = null; SolidEdgePart.Profiles profiles = null; SolidEdgePart.Profile profile = null; SolidEdgeFrameworkSupport.Circles2d circles2d = null; SolidEdgeFrameworkSupport.Circle2d circle2d = null; SolidEdgeFramework.SelectSet selectSet = null; try { // Register with OLE to handle concurrency issues on the current thread. SolidEdgeCommunity.OleMessageFilter.Register(); // Connect to or start Solid Edge. application = SolidEdgeCommunity.SolidEdgeUtils.Connect(true, true); // Get a reference to the documents collection. documents = application.Documents; // Create a new part document. partDocument = documents.AddPartDocument(); // Always a good idea to give SE a chance to breathe. application.DoIdle(); // Get a reference to the RefPlanes collection. refPlanes = partDocument.RefPlanes; // Get a reference to front RefPlane. refPlane = refPlanes.GetFrontPlane(); // Get a reference to the Sketches collection. sketches = partDocument.Sketches; // Create a new sketch. sketch = sketches.Add(); // Get a reference to the Profiles collection. profiles = sketch.Profiles; // Create a new profile. profile = profiles.Add(refPlane); circles2d = profile.Circles2d; circle2d = circles2d.AddByCenterRadius(0.04, 0.05, 0.02); profile.End(SolidEdgePart.ProfileValidationType.igProfileClosed); // Get a reference to the ActiveSelectSet. selectSet = application.ActiveSelectSet; // Empty ActiveSelectSet. selectSet.RemoveAll(); // Add new FaceRotate to ActiveSelectSet. selectSet.Add(circle2d); // Switch to ISO view. application.StartCommand(SolidEdgeConstants.PartCommandConstants.PartViewISOView); } catch (System.Exception ex) { Console.WriteLine(ex.Message); } finally { SolidEdgeCommunity.OleMessageFilter.Unregister(); } }
static void Main(string[] args) { SolidEdgeFramework.Application application = null; SolidEdgeFramework.Documents documents = null; SolidEdgePart.SheetMetalDocument sheetMetalDocument = null; SolidEdgePart.RefPlanes refPlanes = null; SolidEdgePart.RefPlane refPlane = null; SolidEdgePart.Sketchs sketchs = null; SolidEdgePart.Sketch sketch = null; SolidEdgePart.Profiles profiles = null; SolidEdgePart.Profile profile = null; SolidEdgeFrameworkSupport.Circles2d circles2d = null; SolidEdgeFrameworkSupport.Circle2d circle2d = null; SolidEdgePart.Model model = null; SolidEdgePart.ExtrudedCutouts extrudedCutouts = null; SolidEdgePart.ExtrudedCutout extrudedCutout = null; List <SolidEdgePart.Profile> profileList = new List <SolidEdgePart.Profile>(); double finiteDepth1 = 0.5; SolidEdgeFramework.SelectSet selectSet = null; try { // Register with OLE to handle concurrency issues on the current thread. SolidEdgeCommunity.OleMessageFilter.Register(); // Connect to or start Solid Edge. application = SolidEdgeCommunity.SolidEdgeUtils.Connect(true, true); // Get a reference to the Documents collection. documents = application.Documents; // Create a new sheetmetal document. sheetMetalDocument = documents.AddSheetMetalDocument(); // Always a good idea to give SE a chance to breathe. application.DoIdle(); // Call helper method to create the actual geometry. model = SheetMetalHelper.CreateBaseTabByCircle(sheetMetalDocument); // Get a reference to the RefPlanes collection. refPlanes = sheetMetalDocument.RefPlanes; // Get a reference to right RefPlane. refPlane = refPlanes.GetRightPlane(); // Get a reference to the Sketches collection. sketchs = sheetMetalDocument.Sketches; // Add a new Sketch. sketch = sketchs.Add(); // Get a reference to the Profiles collection. profiles = sketch.Profiles; // Add a new Profile. profile = profiles.Add(refPlane); profileList.Add(profile); // Create 2D circle. circles2d = profile.Circles2d; circle2d = circles2d.AddByCenterRadius(0, 0, 0.025); profile.Visible = false; // Get a reference to the ExtrudedCutouts collection. extrudedCutouts = model.ExtrudedCutouts; // Add a new ExtrudedCutout. extrudedCutout = extrudedCutouts.Add( profileList.Count, profileList.ToArray(), SolidEdgePart.FeaturePropertyConstants.igLeft, SolidEdgePart.FeaturePropertyConstants.igFinite, SolidEdgePart.FeaturePropertyConstants.igSymmetric, finiteDepth1, null, SolidEdgePart.KeyPointExtentConstants.igTangentNormal, null, SolidEdgePart.OffsetSideConstants.seOffsetNone, 0, SolidEdgePart.TreatmentTypeConstants.seTreatmentNone, SolidEdgePart.DraftSideConstants.seDraftNone, 0, SolidEdgePart.TreatmentCrownTypeConstants.seTreatmentCrownNone, SolidEdgePart.TreatmentCrownSideConstants.seTreatmentCrownSideNone, SolidEdgePart.TreatmentCrownCurvatureSideConstants.seTreatmentCrownCurvatureNone, 0, 0, SolidEdgePart.FeaturePropertyConstants.igNone, SolidEdgePart.FeaturePropertyConstants.igNone, 0, null, SolidEdgePart.KeyPointExtentConstants.igTangentNormal, null, SolidEdgePart.OffsetSideConstants.seOffsetNone, 0, SolidEdgePart.TreatmentTypeConstants.seTreatmentNone, SolidEdgePart.DraftSideConstants.seDraftNone, 0, SolidEdgePart.TreatmentCrownTypeConstants.seTreatmentCrownNone, SolidEdgePart.TreatmentCrownSideConstants.seTreatmentCrownSideNone, SolidEdgePart.TreatmentCrownCurvatureSideConstants.seTreatmentCrownCurvatureNone, 0, 0); // Get a reference to the ActiveSelectSet. selectSet = application.ActiveSelectSet; // Empty ActiveSelectSet. selectSet.RemoveAll(); // Add new ExtrudedCutout to ActiveSelectSet. selectSet.Add(extrudedCutout); // Switch to ISO view. application.StartCommand(SolidEdgeConstants.SheetMetalCommandConstants.SheetMetalViewISOView); } catch (System.Exception ex) { Console.WriteLine(ex.Message); } finally { SolidEdgeCommunity.OleMessageFilter.Unregister(); } }
static void Main(string[] args) { SolidEdgeFramework.Application application = null; SolidEdgeFramework.Documents documents = null; SolidEdgePart.PartDocument partDocument = null; SolidEdgePart.RefPlanes refPlanes = null; SolidEdgePart.RefPlane refPlane = null; SolidEdgePart.Sketchs sketches = null; SolidEdgePart.Sketch sketch = null; SolidEdgePart.Profiles profiles = null; SolidEdgePart.Profile profile = null; SolidEdgeFrameworkSupport.Circles2d circles2d = null; SolidEdgeFrameworkSupport.Circle2d circle2d = null; SolidEdgePart.Constructions constructions = null; SolidEdgePart.ExtrudedSurfaces extrudedSurfaces = null; SolidEdgePart.ExtrudedSurface extrudedSurface = null; SolidEdgeFramework.SelectSet selectSet = null; try { // Register with OLE to handle concurrency issues on the current thread. SolidEdgeCommunity.OleMessageFilter.Register(); // Connect to or start Solid Edge. application = SolidEdgeCommunity.SolidEdgeUtils.Connect(true, true); // Get a reference to the Documents collection. documents = application.Documents; // Create a new part document. partDocument = documents.AddPartDocument(); // Always a good idea to give SE a chance to breathe. application.DoIdle(); // Get a reference to the RefPlanes collection. refPlanes = partDocument.RefPlanes; // Get a reference to front RefPlane. refPlane = refPlanes.GetFrontPlane(); // Get a reference to the Sketches collection. sketches = partDocument.Sketches; // Create a new sketch. sketch = sketches.Add(); // Get a reference to the Profiles collection. profiles = sketch.Profiles; // Create a new profile. profile = profiles.Add(refPlane); circles2d = profile.Circles2d; circle2d = circles2d.AddByCenterRadius(0.04, 0.05, 0.02); profile.End(SolidEdgePart.ProfileValidationType.igProfileClosed); // Get a reference to the Constructions collection. constructions = partDocument.Constructions; // Get a reference to the ExtrudedSurfaces collection. extrudedSurfaces = constructions.ExtrudedSurfaces; // These parameter variables are declared because we have to pass them as pointers. SolidEdgePart.KeyPointExtentConstants KeyPointFlags1 = SolidEdgePart.KeyPointExtentConstants.igTangentNormal; SolidEdgePart.KeyPointExtentConstants KeyPointFlags2 = SolidEdgePart.KeyPointExtentConstants.igTangentNormal; List <SolidEdgePart.Profile> profileList = new List <SolidEdgePart.Profile>(); for (int i = 1; i <= profiles.Count; i++) { profileList.Add(profiles.Item(i)); } Array profileArray = profileList.ToArray(); // Add a new ExtrudedSurface. extrudedSurface = extrudedSurfaces.Add( NumberOfProfiles: profileArray.Length, ProfileArray: ref profileArray, ExtentType1: SolidEdgePart.FeaturePropertyConstants.igFinite, ExtentSide1: SolidEdgePart.FeaturePropertyConstants.igRight, FiniteDepth1: 0.0127, KeyPointOrTangentFace1: null, KeyPointFlags1: ref KeyPointFlags1, FromFaceOrRefPlane: null, FromFaceOffsetSide: SolidEdgePart.OffsetSideConstants.seOffsetNone, FromFaceOffsetDistance: 0, TreatmentType1: SolidEdgePart.TreatmentTypeConstants.seTreatmentCrown, TreatmentDraftSide1: SolidEdgePart.DraftSideConstants.seDraftInside, TreatmentDraftAngle1: 0.1, TreatmentCrownType1: SolidEdgePart.TreatmentCrownTypeConstants.seTreatmentCrownByOffset, TreatmentCrownSide1: SolidEdgePart.TreatmentCrownSideConstants.seTreatmentCrownSideInside, TreatmentCrownCurvatureSide1: SolidEdgePart.TreatmentCrownCurvatureSideConstants.seTreatmentCrownCurvatureInside, TreatmentCrownRadiusOrOffset1: 0.003, TreatmentCrownTakeOffAngle1: 0, ExtentType2: SolidEdgePart.FeaturePropertyConstants.igFinite, ExtentSide2: SolidEdgePart.FeaturePropertyConstants.igLeft, FiniteDepth2: 0.0127, KeyPointOrTangentFace2: null, KeyPointFlags2: ref KeyPointFlags2, ToFaceOrRefPlane: null, ToFaceOffsetSide: SolidEdgePart.OffsetSideConstants.seOffsetNone, ToFaceOffsetDistance: 0, TreatmentType2: SolidEdgePart.TreatmentTypeConstants.seTreatmentCrown, TreatmentDraftSide2: SolidEdgePart.DraftSideConstants.seDraftNone, TreatmentDraftAngle2: 0, TreatmentCrownType2: SolidEdgePart.TreatmentCrownTypeConstants.seTreatmentCrownByOffset, TreatmentCrownSide2: SolidEdgePart.TreatmentCrownSideConstants.seTreatmentCrownSideInside, TreatmentCrownCurvatureSide2: SolidEdgePart.TreatmentCrownCurvatureSideConstants.seTreatmentCrownCurvatureInside, TreatmentCrownRadiusOrOffset2: 0.003, TreatmentCrownTakeOffAngle2: 0, WantEndCaps: true ); SolidEdgePart.FeaturePropertyConstants ExtentType; SolidEdgePart.FeaturePropertyConstants ExtentSide; double FiniteDepth = 0.0; SolidEdgePart.KeyPointExtentConstants KeyPointFlags = SolidEdgePart.KeyPointExtentConstants.igTangentNormal; // Get extent information for the first direction. extrudedSurface.GetDirection1Extent(out ExtentType, out ExtentSide, out FiniteDepth); // Modify parameters. FiniteDepth = 2.0; ExtentType = SolidEdgePart.FeaturePropertyConstants.igFinite; ExtentSide = SolidEdgePart.FeaturePropertyConstants.igRight; // Apply extent information for the first direction. extrudedSurface.ApplyDirection1Extent( ExtentType, ExtentSide, FiniteDepth, null, ref KeyPointFlags); // Get a reference to the ActiveSelectSet. selectSet = application.ActiveSelectSet; // Empty ActiveSelectSet. selectSet.RemoveAll(); // Add new FaceRotate to ActiveSelectSet. selectSet.Add(extrudedSurface); // Switch to ISO view. application.StartCommand(SolidEdgeConstants.PartCommandConstants.PartViewISOView); } catch (System.Exception ex) { Console.WriteLine(ex.Message); } finally { SolidEdgeCommunity.OleMessageFilter.Unregister(); } }
static void ReportItem(SolidEdgeFrameworkSupport.Circle2d circle2d) { Console.WriteLine("Name: {0}", circle2d.Name); }
static void CreateExtrudedCutout(SolidEdgePart.SheetMetalDocument sheetMetalDocument) { SolidEdgePart.RefPlanes refPlanes = null; SolidEdgePart.RefPlane refPlane = null; SolidEdgePart.Sketchs sketchs = null; SolidEdgePart.Sketch sketch = null; SolidEdgePart.Profiles profiles = null; SolidEdgePart.Profile profile = null; SolidEdgeFrameworkSupport.Circles2d circles2d = null; SolidEdgeFrameworkSupport.Circle2d circle2d = null; SolidEdgePart.Models models = null; SolidEdgePart.Model model = null; SolidEdgePart.ExtrudedCutouts extrudedCutouts = null; SolidEdgePart.ExtrudedCutout extrudedCutout = null; List <SolidEdgePart.Profile> profileList = new List <SolidEdgePart.Profile>(); double finiteDepth1 = 0.5; // Get refplane. refPlanes = sheetMetalDocument.RefPlanes; refPlane = refPlanes.Item(2); // Create 2nd sketch. sketchs = sheetMetalDocument.Sketches; sketch = sketchs.Add(); // Create profile. profiles = sketch.Profiles; profile = profiles.Add(refPlane); // Create 2D circle. circles2d = profile.Circles2d; circle2d = circles2d.AddByCenterRadius(0, 0, 0.025); profile.Visible = false; profileList.Add(profile); models = sheetMetalDocument.Models; model = models.Item(1); extrudedCutouts = model.ExtrudedCutouts; extrudedCutout = extrudedCutouts.Add( profileList.Count, profileList.ToArray(), SolidEdgePart.FeaturePropertyConstants.igLeft, SolidEdgePart.FeaturePropertyConstants.igFinite, SolidEdgePart.FeaturePropertyConstants.igSymmetric, finiteDepth1, null, SolidEdgePart.KeyPointExtentConstants.igTangentNormal, null, SolidEdgePart.OffsetSideConstants.seOffsetNone, 0, SolidEdgePart.TreatmentTypeConstants.seTreatmentNone, SolidEdgePart.DraftSideConstants.seDraftNone, 0, SolidEdgePart.TreatmentCrownTypeConstants.seTreatmentCrownNone, SolidEdgePart.TreatmentCrownSideConstants.seTreatmentCrownSideNone, SolidEdgePart.TreatmentCrownCurvatureSideConstants.seTreatmentCrownCurvatureNone, 0, 0, SolidEdgePart.FeaturePropertyConstants.igNone, SolidEdgePart.FeaturePropertyConstants.igNone, 0, null, SolidEdgePart.KeyPointExtentConstants.igTangentNormal, null, SolidEdgePart.OffsetSideConstants.seOffsetNone, 0, SolidEdgePart.TreatmentTypeConstants.seTreatmentNone, SolidEdgePart.DraftSideConstants.seDraftNone, 0, SolidEdgePart.TreatmentCrownTypeConstants.seTreatmentCrownNone, SolidEdgePart.TreatmentCrownSideConstants.seTreatmentCrownSideNone, SolidEdgePart.TreatmentCrownCurvatureSideConstants.seTreatmentCrownCurvatureNone, 0, 0); }