[CONNECT C++] AssociativePoint::InitXxx

void AssociativePoint::InitOrigin (AssocPoint&  assocPoint,  
  UShort  option  
);

What values are suitable for option?  Help says See also: DisplayHandler::GetSnapOrigin but why?

void AssociativePoint::InitKeypoint  ( AssocPoint &  assocPoint,  
  UShort  vertex,  
  UShort  nVertex,  
  UShort  numerator,  
  UShort  divisor  
 ) 

vertex and nVertex are reasonably clear, but what are numerator and divisor?  Help has this: The number of units (segments) to be considered between the points at vertex and vertex+1. The values of numerator and divisor are used together as the fraction of the distance between the points at vertex and vertex+1, where the association point will be located. The denominator must be between 1 and 32767

Let me put this another way: I have a class

struct  ChooseShapeTool : public DgnElementSetTool

When user selects a shape element, I want to construct an AssocPoint in the _OnDataButton event.  What's a good way to do that?

  • Unknown said:
    void AssociativePoint::InitOrigin (AssocPoint& assocPoint, UShort option );

    This method is analogous to the MDL C function mdlAssoc_createOrigin and its respective documentation; where the option integer value represents the Justification Point (0-default, or: 1 thru 9-origin points being;: LL, UL, UR, LR, CL, UC, CR, LC, CC) and can be used for element types: cell headers, shared cells, text nodes and text elements.

    Unknown said:
    void AssociativePoint::InitKeypoint ( AssocPoint & assocPoint, UShort vertex, UShort nVertex, UShort numerator, UShort divisor )

    This method is analogous to the MDL C function mdlAssoc_createKeypoint and its respective documentation.can be used for Linear element types: lines, line strings and shapes.  An association point can be placed directly on a specific vertex index (nVertex).  Other times it is desired to calculate an association point to a projected (divisor) segment (numerator) between 2 specific vertices (e.g. Create association point between vertex 2 and 3, but projected 2/3 the distance of that segment). Is functionally similar to how MicroStation users set the keypoint snap divisor (ky=3, then snap on a segment project at points 1/3, 2/3, and 3/3 divisor points)

    Unknown said:
    When user selects a shape element, I want to construct an AssocPoint in the _OnDataButton event.  What's a good way to do that?

    You will need to call InitKeypoint with your generic vertex/segment parameters as per above, then associate to the (root) element by calling SetRoot; something like:

        switch (targetElementType)
            {
            case LINE_ELM:
            case LINE_STRING_ELM:
            case SHAPE_ELM:
                {
    AssociativePoint::InitKeypoint (assocPoint, vertex, nVertex, numerator, divisor);
    AssociativePoint::SetRoot(assocPoint, targetId, 0, 0);
    break; }

    HTH,
    Bob



    Answer Verified By: Jon Summers