+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 13
  1. #1
    Senior Member
    Using
    AutoCAD 2007
    Join Date
    Jun 2005
    Location
    Newcastle Upon Tyne
    Posts
    312

    Default create multiline

    Registered forum members do not see this ad.

    Hi,

    Can anyone direct me to a good example of drawing multilines using vba?

    I looked in the help file but doesnt seem to be a lot of info on it?

    Cheers,

    Col

  2. #2
    Full Member
    Using
    Mechanical 2008
    Join Date
    Jan 2008
    Posts
    89

    Default multiline

    You seed your points as XYZ sets, so the number of points for the 'main' part of the line will be an array of sets of 3: the points on your main line will be indexes 0,1,2 for the first point, indexes 3,4,5 for the second point, indexes 6,7,8 for the third point. etc, etc.

    The Justification is the side to offset by. acTop & acBottom are which "side" to offset your "main" line by: acZero basically offsets both lines from your imaginary line running down the middle of your points.

    MLineScale controls the offset amount.

    The sample code provided in the help, is not much help.
    Take the sample code, erase all the points except those from index
    0-8, and make them the following values:
    0=0. 1=0. 2=0.
    3=0. 4=-10. 5=0.
    6=10. 7=-10. 8=0

    This will basically make an "L" shape, unlike the overlapping crap that the sample source gives you.

    Then play with the Justification and MLinScale properties; you should get the hang of it then.

  3. #3
    Super Member fixo's Avatar
    Computer Details
    fixo's Computer Details
    Operating System:
    Windows 7
    Motherboard:
    E7500
    CPU:
    Intel(R)Core(TM)2 DUO CPU 2.93HGz
    RAM:
    4098 Gb
    Graphics:
    1024 Gb
    Using
    AutoCAD 2009
    Join Date
    Jul 2005
    Location
    Pietari, Venäjä
    Posts
    1,591

    Default

    Hi, Col
    Not sure about what you mean but
    hope it will helps, just pick points on screen

    Code:
    Public Sub DrawMLineDynamicaly()
    ' partially borrowed from Tony Tanzillo's 'Getpoint' function
    Dim pickPt As Variant
    Dim mlCoords() As Double
    Dim i As Integer
    Dim oMline As AcadMLine
    
    i = 0
    On Error Resume Next
    pickPt = ThisDrawing.Utility.GetPoint(, vbCr & "First point: ")
    If Err = 0 Then
        ReDim mlCoords(2)
        mlCoords(i) = pickPt(0): mlCoords(i + 1) = pickPt(1): mlCoords(i + 2) = 0#
        Do Until Err.Number <> 0
            i = i + 3
            pickPt = ThisDrawing.Utility.GetPoint(pickPt, vbCr & "Pick next point or press Enter to stop: ")
            ReDim Preserve mlCoords(UBound(mlCoords) + 3)
            mlCoords(i) = pickPt(0): mlCoords(i + 1) = pickPt(1): mlCoords(i + 2) = 0#
            If oMline Is Nothing Then
                Set oMline = ThisDrawing.ModelSpace.AddMLine(mlCoords)
                oMline.Update
            Else
                oMline.Coordinates = mlCoords
                oMline.Update
            End If
        Loop
    
    End If
    
    End Sub
    ~'J'~
    The soul is healed by being with children. - Fyodor Dostoyevsky, novelist (1821-1881)

  4. #4
    Senior Member
    Using
    AutoCAD 2007
    Join Date
    Jun 2005
    Location
    Newcastle Upon Tyne
    Posts
    312

    Default

    Fixo,

    Thank you for that. What I am trying to create is a version of the code you posted but to allow the user to type in size,s width, height and qty of bays and to end product to be curtain walling screen.

    Thank you for thehelp.

    Cheers,

    col

  5. #5
    Senior Member
    Using
    AutoCAD 2007
    Join Date
    Jun 2005
    Location
    Newcastle Upon Tyne
    Posts
    312

    Default

    Rocheey,
    Thank you for the explanation. You didn’t mention mlinestyle? I see from help that it is read only?

    I tried
    Code:
    MyObjMLine.stylename = “MLineStyleName”
    And it returned an error. Does this mean it can not be changed with vba and you have to do it manually?
    Cheers,

    Col

  6. #6
    Super Member fixo's Avatar
    Computer Details
    fixo's Computer Details
    Operating System:
    Windows 7
    Motherboard:
    E7500
    CPU:
    Intel(R)Core(TM)2 DUO CPU 2.93HGz
    RAM:
    4098 Gb
    Graphics:
    1024 Gb
    Using
    AutoCAD 2009
    Join Date
    Jul 2005
    Location
    Pietari, Venäjä
    Posts
    1,591

    Default

    Quote Originally Posted by comcu View Post
    Rocheey,
    Thank you for the explanation. You didn’t mention mlinestyle? I see from help that it is read only?

    I tried
    Code:
    MyObjMLine.stylename = “MLineStyleName”
    And it returned an error. Does this mean it can not be changed with vba and you have to do it manually?
    Cheers,

    Col
    Col, please, take a look at the Help always:

    From Help
    StyleName
    For the MLine object, this property is read-only

    To set desired MlineStyle use:
    Code:
    ThisDrawing.SetVariable "CMLSTYLE", "MyStyleName" '<--style name
    the same things with scale and justification:
    Code:
    ThisDrawing.SetVariable "CMLSCALE", 10.0 <--scale
    ThisDrawing.SetVariable "CMLJUST", 1 '<--justification to middle
    After that you can draw multiline with desired parameters

    ~'J'~
    The soul is healed by being with children. - Fyodor Dostoyevsky, novelist (1821-1881)

  7. #7
    Super Member fixo's Avatar
    Computer Details
    fixo's Computer Details
    Operating System:
    Windows 7
    Motherboard:
    E7500
    CPU:
    Intel(R)Core(TM)2 DUO CPU 2.93HGz
    RAM:
    4098 Gb
    Graphics:
    1024 Gb
    Using
    AutoCAD 2009
    Join Date
    Jul 2005
    Location
    Pietari, Venäjä
    Posts
    1,591

    Default

    Quote Originally Posted by comcu View Post
    Fixo,

    Thank you for that. What I am trying to create is a version of the code you posted but to allow the user to type in size,s width, height and qty of bays and to end product to be curtain walling screen.

    Thank you for thehelp.

    Cheers,

    col
    Col, sorry, I don't understand what you mean
    Please, upload here the small picture or the sample
    drawing to enlight me with it

    ~'J'~
    The soul is healed by being with children. - Fyodor Dostoyevsky, novelist (1821-1881)

  8. #8
    Senior Member
    Using
    AutoCAD 2007
    Join Date
    Jun 2005
    Location
    Newcastle Upon Tyne
    Posts
    312

    Default

    Thank you for the set variable, it worked fine.

    I doo look at help but some times find it hard to get what i am looking for. Thank you for the help.
    I will post a sample drawing/ jpeg later today.

    I would appreciate any pointers. i think i can use the code you posted but jsut have the points calculated from input added by the user.

    will post the jpeg later.

    thank you for the help.

    cheers,

    col

  9. #9
    Super Member fixo's Avatar
    Computer Details
    fixo's Computer Details
    Operating System:
    Windows 7
    Motherboard:
    E7500
    CPU:
    Intel(R)Core(TM)2 DUO CPU 2.93HGz
    RAM:
    4098 Gb
    Graphics:
    1024 Gb
    Using
    AutoCAD 2009
    Join Date
    Jul 2005
    Location
    Pietari, Venäjä
    Posts
    1,591

    Default

    Okay, still waiting for

    ~'J'~
    The soul is healed by being with children. - Fyodor Dostoyevsky, novelist (1821-1881)

  10. #10
    Senior Member
    Using
    AutoCAD 2007
    Join Date
    Jun 2005
    Location
    Newcastle Upon Tyne
    Posts
    312

    Default

    Registered forum members do not see this ad.

    Fixo,

    jpeg attached. it is a very simple example, the amount of columns/ rows could 10 or 100, for eg.

    Im sure i can use you example, i just need to work out how to accept input from the command line and then work out the calculation required.

    cheers,

    col
    Attached Images

Similar Threads

  1. Need better multiline
    By Vigilante in forum AutoLISP, Visual LISP & DCL
    Replies: 198
    Last Post: 8th Jun 2012, 02:06 pm
  2. Missing multiline?
    By Vigilante in forum AutoCAD Beginners' Area
    Replies: 9
    Last Post: 2nd Feb 2011, 06:16 pm
  3. Multiline
    By smalls13_99 in forum AutoCAD Beginners' Area
    Replies: 5
    Last Post: 5th Mar 2008, 10:32 am
  4. Create a multiline / multistyle
    By Bespoke in forum AutoCAD Drawing Management & Output
    Replies: 11
    Last Post: 31st May 2007, 11:05 pm
  5. Multiline Command
    By A5ianKSA in forum AutoCAD General
    Replies: 1
    Last Post: 18th Oct 2003, 05:43 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts