How can the line be pulled out?

Hi,

I have a symbol (cell) that I want to make dynamic. I would like to be able to draw a line with an arrow (something like place note line) and have the ability to pull the line out. 

When the action is been accepted, then the cell must be placed.

Is it possible to do it with IPrimitiveCommandEvents? Is there someone who can help me with this issue? 

  • Unknown said:
    Is it possible to do it with IPrimitiveCommandEvents?

    IPrimitiveCommandEvents provides a framework.  Using that framework you can write your own class that Implements IPrimitiveCommandEvents and creates graphic elements.

    Unknown said:
    I would like to be able to draw a line with an arrow and have the ability to pull the line out

    You can do that with your class.  The _Dynamics event lets you rubber-band your elements as the user moves the cursor.

    MicroStation VBA help provides some examples.  Here's an article that provides a VBA project to draw a shape element.

     
    Regards, Jon Summers
    LA Solutions

  • Hi,

    Unknown said:
    Is there someone who can help me with this issue?

    It depends on what does it mean "help me with this issue". It's not clear if you ask for somebody who will create the macro (which sounds like a commercial request) or need to help with a pieces of you code if a problem will appear (this community is right place for such discussions).

    In MicroStation VBA help there are more examples how IPrimitiveCommand should be used available, e.g. Line Element Creation Command gives a good overview how an element can be created including dynamics. You can start with example code and to modify it to satisfy your needs.

    With regards,

      Jan

  • hello guys,
    here is pieces of my code. I want dynamic arrow direction which rotate with a line (just like Place Note Line)

    Private Sub IPrimitiveCommandEvents_DataPoint(point As Point3d, ByVal View As View)

    If m_nPoints = 0 Then
    CommandState.AccuDrawHints.SetOrigin point


    Dim myLine1 As LineElement

    m_atPoints(0).x = point.x
    m_atPoints(0).y = point.y
    m_atPoints(1).x = point.x + 2
    m_atPoints(1).y = point.y + 1

    Set myLine1 = CreateLineElement2(Nothing, m_atPoints(0), m_atPoints(1))

    ActiveModelReference.AddElement myLine1

    Dim myLine2 As LineElement
    m_atPoints(0).x = point.x
    m_atPoints(0).y = point.y
    m_atPoints(1).x = point.x - 2
    m_atPoints(1).y = point.y + 1

    Set myLine2 = CreateLineElement2(Nothing, m_atPoints(0), m_atPoints(1))
    ActiveModelReference.AddElement myLine2


    CommandState.StartDynamics
    m_atPoints(0) = point
    m_nPoints = 1
    ShowPrompt "Place end point"

    ElseIf m_nPoints = 1 Then
    m_atPoints(1) = point
    Dim oEl As LineElement
    Set oEl = CreateLineElement1(Nothing, m_atPoints)
    ActiveModelReference.AddElement oEl
    oEl.Redraw
    m_atPoints(0) = m_atPoints(1)
    End If

    End Sub
  • Unknown said:
    m_atPoints(0).x = point.x
    m_atPoints(0).y = point.y

    Just assign the entire variable, not its components...

    m_atPoints(0) = point

    Unknown said:
    m_atPoints(1).x = point.x - 2
    m_atPoints(1).y = point.y + 1

    Use the API...

    m_atPoints(1) = Point3dAdd (point, Point3dFromXY (1, -2))

    Unknown said:
    CommandState.StartDynamics

    Once you've started dynamics, now write code in your IPrimitiveCommandEvents_Dynamics subroutine to draw rubber bands.  See VBA help and the example I previously cited.

     
    Regards, Jon Summers
    LA Solutions