2 Replies Latest reply on Feb 5, 2014 2:47 PM by Neil Sommerville

    GD&T Straight Leader without arrow

    Neil Sommerville

      I need some help with creating a GD&T symbol (or IGtol object) through a VBA macro.   Writing (or recording) the code to create and locate the symbol is not a problem.  However when the symbol is placed there is a straight line coming out the side with a arrow at the end of the leader.  

      GD&T before.png

      But what I really want is this:

      GD&T after.png

      I can do this manually buy simplying clicking on the simple and dragging it upward slightly.   This dragging actual cause the symbol to "snap" into position causing the leader to come out the bottom corrner and inline with the edge I selected.  


      I have tried numerous different SELECTBYID and SETPOSITION methods but I am unable to cause the symbol look like the 2nd image by API.   Does anyone know of a way to do this with out moving it manually?  Is there settings on the IGTOL or ANNOTATION object that I can help me?   Is there a way to "drag" an object by API instead of moving it from poin to point?


      Thanks for the help.

        • Re: GD&T Straight Leader without arrow
          Oleg Bezyaev

          SelectionMgr swSelMgr = swModel.SelectionManager as SelectionMgr;

          Gtol myGtol = (Gtol)swSelMgr.GetSelectedObject6(1, -1);

          Annotation myAnn = gtol.GetAnnotation();

          int ppp = myAnn.SetArrowHeadStyleAtIndex(0, (int)swArrowStyle_e.swNO_ARROWHEAD);

          Or something like this


          swView = (View)swDraw.GetFirstView();


                      while ((swView != null))


                          count = (int)swView.GetGTolCount();

                          Gtol gtol = default(Gtol);

                          if (count > 0)


                              Object[] Annotations = (Object[])swView.GetGTols();

                              for (int j = 0; j <= Annotations.GetUpperBound(0); j++)


                                  gtol = (Gtol)Annotations[j];

                                  Annotation UU = gtol.GetAnnotation();

                                  int ppp = UU.SetArrowHeadStyleAtIndex(0, (int) swArrowStyle_e.swNO_ARROWHEAD);



                          swView = (View)swView.GetNextView();


            • Re: GD&T Straight Leader without arrow
              Neil Sommerville

              Thanks for the response.  That got rid of the arrow head but it didn't reposition the location of the leader to the box nor did it set a gap between the leader and the edge.

              GD&T after no_arrowhead.png  vs  GD&T after.png

              Now I have code that can change the gaps on leaders so that could be a work around, but what I also want is for the leader to come from the corner of the GD&T block. 


              If it can be done manually I would assume that there should be a way to do it through API.  There has got to be a way!