Jump to content

Recommended Posts

Posted

Hi,

 

I'm trying to draw a MLINE using the vertex of a Polyline and that part of the macro works ok, but when I try to change the justification and/or the scale of the MLINE changing the system variables before drawing the MLINE, it doesn't work, I always get the same justification and/or scale.

 

The strangest thing is that when I check the system variables in the command line they have the value the macro set but the MLINE drawn by the macro doesn't assume the new justification and/or scale.

 

What is the problem? Using Autocad 2009 or 2014. Here is my code>

 


Public Sub poly()
   Dim pline As AcadLWPolyline
   Dim multiLine As AcadMLine
   Dim points(0 To 5) As Double
   Dim mpoints(0 To  As Double
   Dim varData As Variant
   
   points(0) = 2: points(1) = 4
   points(2) = 4: points(3) = 2
   points(4) = 6: points(5) = 8
   
   mpoints(0) = 2: mpoints(1) = 4: mpoints(2) = 0
   mpoints(3) = 4: mpoints(4) = 2: mpoints(5) = 0
   mpoints(6) = 6: mpoints(7) = 8: mpoints( = 0
   
   ThisDrawing.SetVariable "CMLJUST", 1
   ThisDrawing.SetVariable "CMLSCALE", 3
   
   ThisDrawing.Regen acActiveViewport
   
   Set pline = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
   
   Set multiLine = ThisDrawing.ModelSpace.AddMLine(mpoints)
   multiLine.Update

   ThisDrawing.Application.ZoomAll
   
End Sub

 

Thanks

MLINE.png

Posted

Try using MLine properties instead of system variables

for instance

    multiLine.Justification = acBottom
   multiLine.Lineweight = acLnWt005

Posted

Thank you, it worked. Just one correction, to change the Scale the property is MLineScale not Lineweight.

 

Regards.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...