AddKeypoint : Hole - Point

Hello all,

 

I need to constraint hole center to point from exisiting sketch. I tried

 

 

holeProfile.Holes2d.Add(

profile.Points2d.Item(iCreatePoint).x,

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

holeProfile.Visible = false;

 

SolidEdgeFrameworkSupport.Relations2d relats =

(SolidEdgeFrameworkSupport.Relations2d) holeProfile.Relations2d;

 

relats.AddKeypoint(holeProfile.Holes2d.Item(1),

(int) SolidEdgeConstants.KeypointIndexConstants.igCircleCenter,

partSketch.Profiles.Item(1).Points2d.Item(iCreatePoint),

(int) SolidEdgeConstants.KeypointIndexConstants.igCircleCenter,

null);

 

.....

 

I also tried

 

relats.AddPointOn(holeProfile.Holes2d.Item(1),

(int) SolidEdgeConstants.KeypointIndexConstants.igCircleCenter,

partSketch.Profiles.Item(1).Points2d.Item(iCreatePoint),

null);

 

 

but both was unsuccessful.

 

Do you have any idea what is wrong?

 

Best Regards,

 

Jara

 

 

Posted by: Jara Ctverak
Post date: 4/25/2007 2:03:45 AM

2 REPLIES

RE: AddKeypoint : Hole - Point

Solved.

 

changed:

 

relats.AddKeypoint(..., null);

 

to:

 

relats.AddKeypoint(..., 1);

 

I do not know why but it works.

 

I have to say that these parameters which can use in VB its (unknown) default (so they are omited) and in C# must be filled annoyed me very much.

 

How do you find such parameters meaning as "Object guaranteed_ok" in this case?

 

Or is there any possibility to call method with its default value as in VB?

 

Best Regards,

 

Jara

 

 

Posted by: Jara Ctverak
Post date: 4/25/2007 10:28:14 PM

RE: AddKeypoint : Hole - Point

Hi Jara,

 

for optional parameters that are reference types (object etc.) you can use System.Type.Missing to pass nothing and use the default value. If you're not sure if you can use it for a parameter type just try it out, if c# compiles it then it's OK.

 

Calum

 

Posted by: Calum McLellan
Post date: 4/25/2007 10:51:16 PM