Register  Login   Search
 Latest Posts Minimize

How to ask values in mm?
Solid Edge Programming
03/11/2010 12:26 AM
jurajjoob

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


  
 Forums Minimize

Subject: Through the program to create a square tube???
Prev Next
You are not authorized to post a reply.

Author Messages
fatkidsUser is Offline
Site Member
Site Member
Posts:36

02/04/2010 12:37 AM  

Hi all!

I need to through the program to create a square tube, Code is as follows:

            SolidEdgeFramework.Application application = null;
            SolidEdgeFramework.Documents documents = null;
            SolidEdgePart.PartDocument part = null;
            SolidEdgePart.ProfileSets profileSets = null;
            SolidEdgePart.ProfileSet profileSet = null;
            SolidEdgePart.Profiles profiles = null;
            SolidEdgePart.Profile profile = null;
            SolidEdgePart.RefPlanes refplanes = null;
            SolidEdgeFrameworkSupport.Relations2d relations2d = null;
            SolidEdgeFrameworkSupport.Relation2d relation2d = null;
            SolidEdgeFrameworkSupport.Lines2d lines2d = null;
            SolidEdgeFrameworkSupport.Line2d line2d = null;
            SolidEdgeFrameworkSupport.Circle2d circle2d = null;
            SolidEdgeFrameworkSupport.Arcs2d arcs = null;
            SolidEdgeFrameworkSupport.Arc2d arc = null;
            SolidEdgePart.Models models = null;
            SolidEdgePart.Model model = null;
            System.Array aProfiles = null;
            try
            {
                // Connect to a running instance of Solid Edge
                application = (SolidEdgeFramework.Application)Marshal.GetActiveObject("SolidEdge.Application");
                // Get a reference to the documents collection
                documents = application.Documents;
                // Create a new part document
                part = (SolidEdgePart.PartDocument)documents.Add("SolidEdge.PartDocument", Missing.Value);
                // Get a reference to the profile sets collection
                profileSets = part.ProfileSets;
                // Add a new profile set
                profileSet = profileSets.Add();
                // Get a reference to the profiles collection
                profiles = profileSet.Profiles;
                // Get a reference to the ref planes collection
                refplanes = part.RefPlanes;
                // Add a new profile
                profile = profiles.Add(refplanes.Item(3));
                // Get a reference to the lines2d collection
                lines2d = profile.Lines2d;
                arcs = profile.Arcs2d;
                // Draw the outer Profile
                lines2d.AddBy2Points(0, 0, 0.08, 0);
                lines2d.AddBy2Points(0.08, 0, 0.08, 0.08);
                lines2d.AddBy2Points(0.08, 0.08, 0, 0.08);
                lines2d.AddBy2Points(0, 0.08, 0, 0);

               // Draw the inner Profile
                lines2d.AddBy2Points(0.02, 0.02, 0.06, 0.02);
                lines2d.AddBy2Points(0.06, 0.02, 0.06, 0.06);
                lines2d.AddBy2Points(0.06, 0.06, 0.02, 0.06);
                lines2d.AddBy2Points(0.02, 0.06, 0.02, 0.02);
                
                 // Define Relations among the Line objects to make the Profile closed
                relations2d = (SolidEdgeFrameworkSupport.Relations2d)profile.Relations2d;
                relation2d = relations2d.AddKeypoint(lines2d.Item(1), (int)KeypointIndexConstants.igLineEnd, lines2d.Item(2), (int)KeypointIndexConstants.igLineStart, true);
                relation2d = relations2d.AddKeypoint(lines2d.Item(2), (int)KeypointIndexConstants.igLineEnd, lines2d.Item(3), (int)KeypointIndexConstants.igLineStart, true);
                relation2d = relations2d.AddKeypoint(lines2d.Item(3), (int)KeypointIndexConstants.igLineEnd, lines2d.Item(4), (int)KeypointIndexConstants.igLineStart, true);
                relation2d = relations2d.AddKeypoint(lines2d.Item(4), (int)KeypointIndexConstants.igLineEnd, lines2d.Item(1), (int)KeypointIndexConstants.igLineStart, true);

                relation2d = relations2d.AddKeypoint(lines2d.Item(5), (int)KeypointIndexConstants.igLineEnd, lines2d.Item(6), (int)KeypointIndexConstants.igLineStart, true);
                relation2d = relations2d.AddKeypoint(lines2d.Item(6), (int)KeypointIndexConstants.igLineEnd, lines2d.Item(7), (int)KeypointIndexConstants.igLineStart, true);
                relation2d = relations2d.AddKeypoint(lines2d.Item(7), (int)KeypointIndexConstants.igLineEnd, lines2d.Item(8), (int)KeypointIndexConstants.igLineStart, true);
                relation2d = relations2d.AddKeypoint(lines2d.Item(8), (int)KeypointIndexConstants.igLineEnd, lines2d.Item(5), (int)KeypointIndexConstants.igLineStart, true);
                //relation2d = relations2d.AddKeypoint(lines2d.Item(10), (int)KeypointIndexConstants.igLineEnd, lines2d.Item(11), (int)KeypointIndexConstants.igLineStart, true);
                //relation2d = relations2d.AddKeypoint(lines2d.Item(11), (int)KeypointIndexConstants.igLineEnd, lines2d.Item(12), (int)KeypointIndexConstants.igLineStart, true);
                //relation2d = relations2d.AddKeypoint(lines2d.Item(12), (int)KeypointIndexConstants.igLineEnd, lines2d.Item(1), (int)KeypointIndexConstants.igLineStart, true);
                arcs.AddAsFillet(lines2d.Item(1), lines2d.Item(2), 0.01, -1, 1);
                arcs.AddAsFillet(lines2d.Item(2), lines2d.Item(3), 0.01, -1, -1);
                arcs.AddAsFillet(lines2d.Item(3), lines2d.Item(4), 0.01, 1, -1);
                arcs.AddAsFillet(lines2d.Item(4), lines2d.Item(1), 0.01, 1, 1);

                arcs.AddAsFillet(lines2d.Item(5), lines2d.Item(6), 0.01, -1, 1);
                arcs.AddAsFillet(lines2d.Item(6), lines2d.Item(7), 0.01, -1, -1);
                arcs.AddAsFillet(lines2d.Item(7), lines2d.Item(8), 0.01, 1, -1);
                arcs.AddAsFillet(lines2d.Item(8), lines2d.Item(5), 0.01, 1, 1);


                // Close the profile
                profile.End(SolidEdgePart.ProfileValidationType.igProfileClosed);
                // Hide the profile
                profile.Visible = false;
                // Create a new array of profile objects
                aProfiles = Array.CreateInstance(typeof(SolidEdgePart.Profile), 1);
                aProfiles.SetValue(profile, 0);
                // Get a reference to the models collection
                models = part.Models;
                // Create the extended protrusion.
                model = models.AddFiniteExtrudedProtrusion(aProfiles.Length, ref aProfiles, SolidEdgePart.FeaturePropertyConstants.igRight, 0.05, Missing.Value, Missing.Value, Missing.Value, Missing.Value);

After the program runs, the resulting error message is as follows:

Internal error:Unable to computer topology information for the sketched profile.

Please help!

[script removed]
fatkidsUser is Offline
Site Member
Site Member
Posts:36

03/10/2010 2:58 AM  
I do it!
SolidEdgePart.Profile profile = null;
SolidEdgeFrameworkSupport.Line2d[] line2d = new SolidEdgeFrameworkSupport.Line2dΒ]
//SolidEdgePart.Profile[] profile_arr = new SolidEdgePart.ProfileΎ]
SolidEdgeFramework.Application application = null;
SolidEdgeFramework.Documents documents = null;
SolidEdgePart.PartDocument part = null;
System.Array aProfiles = null;


try
{

application = (SolidEdgeFramework.Application)Marshal.GetActiveObject("SolidEdge.Application");

documents = application.Documents;
// Create a new part document
part = (SolidEdgePart.PartDocument)documents.Add("SolidEdge.PartDocument", Missing.Value);
profile = part.ProfileSets.Add().Profiles.Add(part.RefPlanes.Item(3));
line2dΎ] = profile.Lines2d.AddBy2Points(0, 0, 0.08, 0);
line2dΏ] = profile.Lines2d.AddBy2Points(0.08, 0, 0.08, 0.08);
line2dΐ] = profile.Lines2d.AddBy2Points(0.08, 0.08, 0, 0.08);
line2dΑ] = profile.Lines2d.AddBy2Points(0, 0.08, 0, 0);
profile.Arcs2d.AddAsFillet(line2dΎ], line2dΏ], 0.01, -1, 1);
profile.Arcs2d.AddAsFillet(line2dΏ], line2dΐ], 0.01, -1, -1);
profile.Arcs2d.AddAsFillet(line2dΐ], line2dΑ], 0.01, 1, -1);
profile.Arcs2d.AddAsFillet(line2dΎ], line2dΑ], 0.01, 1, 1);
line2dΎ] = profile.Lines2d.AddBy2Points(0.02, 0.02, 0.06, 0.02);
line2dΏ] = profile.Lines2d.AddBy2Points(0.06, 0.02, 0.06, 0.06);
line2dΐ] = profile.Lines2d.AddBy2Points(0.06, 0.06, 0.02, 0.06);
line2dΑ] = profile.Lines2d.AddBy2Points(0.02, 0.06, 0.02, 0.02);
profile.Arcs2d.AddAsFillet(line2dΎ], line2dΏ], 0.01, -1, 1);
profile.Arcs2d.AddAsFillet(line2dΏ], line2dΐ], 0.01, -1, -1);
profile.Arcs2d.AddAsFillet(line2dΐ], line2dΑ], 0.01, 1, -1);
profile.Arcs2d.AddAsFillet(line2dΎ], line2dΑ], 0.01, 1, 1);
profile.End(SolidEdgePart.ProfileValidationType.igProfileAllowNested);
profile.End(SolidEdgePart.ProfileValidationType.igProfileClosed);
//profile_arrΎ] = profile;
aProfiles = Array.CreateInstance(typeof(SolidEdgePart.Profile), 1);
aProfiles.SetValue(profile, 0);
part.Models.AddFiniteExtrudedProtrusion(1, ref aProfiles, SolidEdgePart.FeaturePropertyConstants.igLeft, 0.05, Missing.Value, Missing.Value, Missing.Value, Missing.Value);
}
catch (System.Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{

if (line2d != null)
{
Marshal.ReleaseComObject(line2d);
line2d = null;
}

if (profile != null)
{
Marshal.ReleaseComObject(profile);
profile = null;
}

if (part != null)
{
Marshal.ReleaseComObject(part);
part = null;
}
if (documents != null)
{
Marshal.ReleaseComObject(documents);
documents = null;
}
if (application != null)
{
Marshal.ReleaseComObject(application);
application = null;
}
}
You are not authorized to post a reply.
Forums > Solid Edge > Programming > Through the program to create a square tube???



ActiveForums 3.7

  

 Users Online Minimize

Membership Membership:
Latest New User Latest: simoned
New Today New Today: 0
New Yesterday New Yesterday: 1
User Count Overall: 1767

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