draw a line and change the view

Discussion in 'AutoCAD' started by steve mangelschots, Apr 5, 2004.

  1. Hello,

    I've made a sub to draw a line in vba:

    Sub lijn(ByVal x1 As Double, ByVal y1 As Double, ByVal x2 As Double, ByVal y2 As Double, z As Double)
    Dim beginpnt(0 To 2) As Double
    Dim eindpnt(0 To 2) As Double
    Dim lijn As AcadLine
    Dim currThickness As Double

    beginpnt(0) = x1: eindpnt(0) = x2
    beginpnt(1) = y1: eindpnt(1) = y2
    beginpnt(2) = 0: eindpnt(2) = 0

    Set lijn = ThisDrawing.ModelSpace.AddLine(beginpnt, eindpnt)
    lijn.Thickness = z
    lijn.Update
    End sub 'End of sub lijn

    When I use it in top view everything works fine:

    sub draw_line
    bassTekenen.lijn 0, 150, 0, 200, 0
    end sub 'End of draw line

    But when I switch to front view the line appears as a dot.
    My question is how I should programme the view switch?


    Thanks
    Steve
     
    steve mangelschots, Apr 5, 2004
    #1
  2. steve mangelschots

    Jeff Mishler Guest

    But when I switch to front view the line appears as a dot.
    What do you expect to see?
    A line in the Y axis that has 0 thickness will appear as a dot in the
    "front" view.
    A line in the X axis that has 0 thickness will appear the same in "top" &
    "front" views.

    Jeff
     
    Jeff Mishler, Apr 5, 2004
    #2
  3. Sorry
    I think I did not explain myself very well.

    After changing to front view I run my macro again.
     
    steve mangelschots, Apr 5, 2004
    #3
  4. steve mangelschots

    Jeff Mishler Guest

    Sorry,
    Look at the "TranslateCoordinates" method and UCS's

    HTH,
    Jeff
     
    Jeff Mishler, Apr 5, 2004
    #4
  5. steve mangelschots

    Jeff Mishler Guest

    Steve, please disregard my last post.

    I meant to suggest the "TransformBy" method. You also might want to look at
    the "GetUCSMatrix" method.

    Jeff
     
    Jeff Mishler, Apr 5, 2004
    #5
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.