VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Create a multline in VBA

5 REPLIES 5
Reply
Message 1 of 6
Jocieldo
1140 Views, 5 Replies

Create a multline in VBA

Hi,
My question is about the criation of the mulilines using UTM and VBA.
First, Sorry for the bad english.

Let's go!
I have the next script:

CODE - SORRY DE CODE BOX DONT WORK.. 😞
---------------------------------------------------------------------------------------------------------

Public Sub LinhaDuplaContinua()

Dim multiLineObj As AcadMLine
Dim Vertices(1 To 36) As Double

Vertices(1) = 547990.632012883
Vertices(2) = 9500776.33954744
Vertices(3) = 0
Vertices(4) = 547988.412000853
Vertices(5) = 9500774.13006581
Vertices(6) = 0
Vertices(7) = 547986.19133176
Vertices(8) = 9500770.81518348
Vertices(9) = 0
Vertices(10) = 547983.970005683
Vertices(11) = 9500766.39490044
Vertices(12) = 0
Vertices(13) = 547977.30800006
Vertices(14) = 9500756.45025303
Vertices(15) = 0
Set multiLineObj = ThisDrawing.ModelSpace.AddMLine(Vertices)

End Sub

---------------------------------------------------------------------------------------------------------


This script add a new multi-line in the AUTOCAD.

How I configure that line in the VBA? I need create parallel lines with determinate offset and width.
I need create this type lines in determinate time:

Continuous Double Line:
______________________________
______________________________

Double Right Dashed Line
_______________________________
_ _ _ _ _ _ _ _ _ _ _ _ _

Double Left Dashed Line
_ _ _ _ _ _ _ _ _ _ _ _ _
_______________________________

Double Dashed Line
_ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _

How i configure that in the VBA?
Thanks!!!

5 REPLIES 5
Message 2 of 6
norman.yuan
in reply to: Jocieldo

You need to have different MLine styles defined in the drawing, have predefined MLine style file (*.mln file) loaded.

 

Then when you use VBA code to create a MLine (as your code shows by calling ThisDrawing.ModelSpace.AddMLine(), the newly created MLine will go with whatever current MLine style is. Therefore, you need to set desired MLine stype as current prior to creating the MLine. You use ThisDocument.SetVariable() to set system variable "CMLSTYLE" to the desired MLine style name.

Norman Yuan

Drive CAD With Code

EESignature

Message 3 of 6
Jocieldo
in reply to: Jocieldo

Thanks very much!

Now,
Have I change the width of this Mline?
Ex:

Now:
_________________
_________________

Changed:
=================
=================

Obs: "=" is equal to "black block" 😉

I can't see that configuration in the MLSTYLE command.

Can you help me?

Thanks!!!

Message 4 of 6
leipengshang
in reply to: Jocieldo

how to define acadmline justification to center as default.  by change systemvariable?or do something?

Message 5 of 6
MakCADD
in reply to: leipengshang

you can center it by justification zero

 

 

Message 6 of 6
leipengshang
in reply to: MakCADD

thanks ,finally i found the solution .i could set systemvariable "CMLJUST"to "1".thats can be done

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost