Create hole

Valued Contributor
Valued Contributor

Hello all,

 

I am trying to create several holes into all components in assembly but I can create only first one and when I m trying to create second it is created but than first next SolidEdge method crashes (probably SolidEdge is kicked by some internal error). When body already contains hole (manualy created) this situation occures directly after creation of first hole.

It seems that when some hole exists I have to initialize creation of holes somehow but I don't know how. (When I drill only one hole to each component than everything is OK)

 

for(int iCreatePoint = 1; iCreatePoint

profile.Points2d.Count; iCreatePoint++)

{

SolidEdgePart.Profile holeProfile =

(SolidEdgePart.Profile)

partDoc.ProfileSets.Add().Profiles.Add(partDoc.RefPlanes.Item(partDoc.RefPlanes.Count));

 

holeProfile.Holes2d.Add(

profile.Points2d.Item(iCreatePoint).x,

profile.Points2d.Item(iCreatePoint).y);

holeProfile.Visible = false;

 

 

SolidEdgePart.HoleData holeData =

partDoc.HoleDataCollection.Add(

SolidEdgePart.FeaturePropertyConstants.igRegularHole, 0.005,

null, null, null, null, null, null, null, null, null,

null, null, null, null, null, null, null, null, null);

 

 

SolidEdgePart.Hole hole = (SolidEdgePart.Hole)

partDoc.Models.Item(iModel).Holes.AddFromTo(

holeProfile, placementFace, throughFace, holeData);

 

}

 

 

Thanks for any suggestion,

 

Best regards,

 

Posted by: Jara Ctverak
Post date: 4/23/2007 12:42:52 AM

2 REPLIES

RE: Create hole

Valued Contributor
Valued Contributor

Now I better know where the problem is. I added code to check if through and placement faces are valid.

 

 

 

for(int iCreatePoint = 1; iCreatePoint

profile.Points2d.Count; iCreatePoint++)

{

SolidEdgePart.Profile holeProfile =

(SolidEdgePart.Profile)

partDoc.ProfileSets.Add().Profiles.Add(partDoc.RefPlanes.Item(partDoc.RefPlanes.Count));

 

holeProfile.Holes2d.Add(

profile.Points2d.Item(iCreatePoint).x,

profile.Points2d.Item(iCreatePoint).y);

holeProfile.Visible = false;

 

SolidEdgeFrameworkSupport.Dimensions dims =

(SolidEdgeFrameworkSupport.Dimensions)holeProfile.Dimensions;

 

 

if(holeProfile.End(SolidEdgePart.ProfileValidationType.igProfileClosed) != 0)

{

string exceptionString =

"Profile not closed";

 

throw (new Exception(exceptionString));

}

 

 

SolidEdgePart.HoleData holeData =

partDoc.HoleDataCollection.Add(

SolidEdgePart.FeaturePropertyConstants.igRegularHole, 0.005,

null, null, null, null, null, null, null, null, null,

null, null, null, null, null, null, null, null, null);

 

System.Object keySizePlacement;

System.Array referenceKeyPlacement =

System.Array.CreateInstance(typeof(Byte), 0);

placementFace.GetReferenceKey(

ref referenceKeyPlacement, out keySizePlacement);

 

System.Object keySizeThrough;

System.Array referenceKeyThrough =

System.Array.CreateInstance(typeof(Byte), 0);

throughFace.GetReferenceKey(

ref referenceKeyThrough, out keySizeThrough);

 

SolidEdgePart.Hole hole = (SolidEdgePart.Hole)

partDoc.Models.Item(iModel).Holes.AddFromTo(

holeProfile, placementFace, throughFace, holeData);

 

partDoc.BindKeyToObject(ref referenceKeyPlacement, out obj);

 

 

partDoc.BindKeyToObject(ref referenceKeyThrough, out obj);

 

}

 

 

 

than when first hole is created and tool comes to second it finished with error on GetReferenceKey on placement face which probably mean that faces are still not valid. But why?

 

 

Thanks for any suggestion.

 

Best Regards,

 

Jara

 

 

 

Posted by: Jara Ctverak
Post date: 4/23/2007 11:45:50 PM

RE: Create hole

Valued Contributor
Valued Contributor

OK Solved

 

out object must be assigned to appropriate face.

 

Jata

 

Posted by: Jara Ctverak
Post date: 4/25/2007 2:01:52 AM