Reply

How to get a edge's endpoints coordinates in assembly document?

[ Edited ]

 

Jason, sorry to bother you. How to get a edge's endpoints coordinates in assembly document? I tried with the function of Vertex.GetPointData(ref Array), but the the coordinates is in part document. Could you give me a example? Thanks!

 

Posted by: assassin 007
Post date: 6/18/2009 7:29:59 AM

4 REPLIES

RE: How to get a edge's endpoints coordinates in assembly document?

[ Edited ]

 

Hi,

I'm including an example for you (VBNet)

The example works with a part placed directly under the main ASM. If the part is placed in a subassembly or below, then it's a little more complicated.

I hope this helps,

Julian

 

Posted by: Julian Guillo
Post date: 6/18/2009 11:53:45 PM

RE: How to get a edge's endpoints coordinates in assembly document?

[ Edited ]

Hi, Julian, thanks! I have another questions, could you help me to analyze the following codes in C#?

faces=Array.CreateInstance(typeof(SolidEdgeGeometry.Face),2);

refPrimface = asmdoc.CreateReference(primoccur, (object)face) as SolidEdgeFramework.Reference;

edge.GetFaces(out facenumber, ref faces);

for (int i = 0; i

{

slaveface = faces.GetValue(i) as SolidEdgeGeometry.Face;

if (slaveface != face)

{

break;

}

}

refSlaveface = asmdoc.CreateReference(primoccur, (object)slaveface) as SolidEdgeFramework.Reference;

refPlane = asmdoc.AsmRefPlanes.AddParallelByDistance(refPrimface,

0,

SolidEdgeConstants.ReferenceElementConstants.igNormalSide,

refSlaveface,

SolidEdgeConstants.ReferenceElementConstants.igPivotStart,

Missing.Value);

 

holedata=asmdoc.HoleDataCollection.Add(SolidEdgePart.FeaturePropertyConstants.igRegularHole,

ecc.GetD1()/1000.0,Missing.Value,Missing.Value,Missing.Value,

Missing.Value,Missing.Value,Missing.Value,Missing.Value,

Missing.Value,Missing.Value,Missing.Value,Missing.Value,

Missing.Value,Missing.Value,Missing.Value,Missing.Value,

Missing.Value,Missing.Value,Missing.Value);

 

layout = asmdoc.Layouts.Add(refPlane, null,out layoutstatus);

 

profile = layout.Profile as SolidEdgePart.Profile;

 

profile.Convert3DCoordinate((double)newstartpt.GetValue(0), (double)newstartpt.GetValue(1), (double)newstartpt.GetValue(2),

out x2d, out y2d);

profile.Convert3DCoordinate((double)newendpt.GetValue(0), (double)newendpt.GetValue(1), (double)newendpt.GetValue(2),

out x2ds, out y2ds);

 

if (x2d

{

x = x2d*1000; y = y2d*1000;

}

else

{

x = x2ds*1000; y = y2ds*1000;

}

 

profiles = new List();

y += ecc.GetH2();

 

layouts = new List();

for (int i = 0; i

{

 

x += holespacelist.GetSpacevalue();

if (holespacelist.GetNextHoleType() == 1)

{

 

profile = layout.Profile as SolidEdgePart.Profile;

profile.Holes2d.Add(x/1000,y/1000);

profiles.Add(profile);

 

}

}

aProfiles = Array.CreateInstance(typeof(SolidEdgePart.Profile), profiles.Count);

for (int i = 0; i

aProfiles.SetValue(profiles, i);

 

aParts = Array.CreateInstance(typeof(SolidEdgeAssembly.Occurrence), 1);

aParts.SetValue(primoccur, 0);

extendside=SolidEdgePart.FeaturePropertyConstants.igLeft;

 

holedepth=ecc.GetH1()/1000;

keypointflag = SolidEdgePart.KeyPointExtentConstants.igInteriorTangentNormal;

 

asmfeatures = asmdoc.AssemblyFeatures;

Array tempProfile = Array.CreateInstance(typeof(SolidEdgePart.Profile), 1);

tempProfile.SetValue(aProfiles.GetValue(0), 0);

asmholes = asmfeatures.AssemblyFeaturesHoles;

asmhole = asmholes.Add((uint)aParts.Length, ref aParts,

//(uint)tempProfile.Length,ref tempProfile

(uint)aProfiles.Length, ref aProfiles,

ref extendside,

holedata,

SolidEdgePart.FeaturePropertyConstants.igFinite,

ref holedepth,

null, null, null, ref keypointflag);

 

Posted by: assassin 007
Post date: 6/20/2009 6:53:43 AM

RE: How to get a edge's endpoints coordinates in assembly document?

[ Edited ]

If the aProfiles.Length>1, the assemblyfeaturehole will be not created correctly. There should be a excalmatory mark(!) before the feature. And the Feature will be ok after I modified it, I do nothing just enter the hole's sketch and return, it will be ok. How to modify my codes? Maybe you can give me an idea?

 

Posted by: assassin 007
Post date: 6/20/2009 7:02:08 AM

RE: How to get a edge's endpoints coordinates in assembly document?

[ Edited ]

 

,Hi, All, anybody can help me ?

 

Posted by: assassin 007
Post date: 6/22/2009 2:19:35 AM