Martin Gagnon

Dimension does not snap to edge midpoint

Discussion created by Martin Gagnon on Apr 30, 2020
Latest reply on May 5, 2020 by Martin Gagnon

Good day! First time on a discussion forum. I'm doing a C# dll to dimension 2D drawings automatically. Everything worked well when snap points were "End" and "Center". Now, that's another story for "Midpoint". We can see in the picture that the Midpoint IS selected, but the dimension is not created. Why?

 

I've tried many things but nothing worked. Here's the piece of code that is suppose to do that:

 

//MessageBox.Show("Make Selection with the snapPoint");
switch (snapPoint.ToLower())
{
case "end":
         swModel.Extension.SelectByRay(dimensionX, dimensionY, 0, 0, 0, -1, selectionRay,          (int)swSelectType_e.swSelVERTICES, true, 0, 0);
         break;

case "midpoint":
         swModel.Extension.SelectByRay(dimensionX, dimensionY, 0, 0, 0, -1, selectionRay,          (int)swSelectType_e.swSelEDGES, true, 0, 0);
         swModel.SelectMidpoint();
         break;

 

And the dimension used is:

 

swModel.AddVerticalDimension2(dimensionPlacePointX, dimensionPlacePointY, 0);

 

What's wrong?

 

Thanks!

Outcomes