Draw All Linetypes

Draw All Linetypes

Anonymous
Not applicable
302 Views
5 Replies
Message 1 of 6

Draw All Linetypes

Anonymous
Not applicable
I wrote this little sub in an effort to straighten out the linetypes we're using and thought it may be useful to someone else. If not, please ignore. Sub DrawEachLType() Dim vPnt As Variant, vFPt(2) As Double, vTPt(2) As Double Dim oLTyps As AcadLineTypes, oLTyp As AcadLineType Dim oLin As AcadLine, oTxt As AcadText vPnt = ThisDrawing.Utility.GetPoint(, vbCrLf & "From point: ") vFPt(0) = vPnt(0): vFPt(1) = vPnt(1): vFPt(2) = 0# vTPt(0) = vPnt(0) + 5#: vTPt(1) = vPnt(1): vTPt(2) = 0# Set oLTyps = ThisDrawing.Linetypes For Each oLTyp In oLTyps vFPt(1) = vFPt(1) + 0.25 vTPt(1) = vTPt(1) + 0.25 Set oLin = ThisDrawing.ModelSpace.AddLine(vFPt, vTPt) oLin.Linetype = oLTyp.Name oLin.Update: Set oLin = Nothing Set oTxt = ThisDrawing.ModelSpace.AddText(" " & oLTyp.Name, vTPt, 0.1) oTxt.Alignment = acAlignmentMiddleLeft: oTxt.TextAlignmentPoint = vTPt oTxt.Update: Set oTxt = Nothing Next oLTyp Set oLTyps = Nothing End Sub
0 Likes
303 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable
Greetings,

I'm a little ignorant on running subs in AutoCAD.

How would the average person use this code? I'm guessing I'd copy into an empty file, save it as something and then AP load it in AutoCAD?

Thanks!
0 Likes
Message 3 of 6

Anonymous
Not applicable
Yeah. Have you tried it?
___

wrote in message news:5055497@discussion.autodesk.com...
I'm guessing I'd copy into an empty file, save it as something and then AP
load it in AutoCAD?
0 Likes
Message 4 of 6

Anonymous
Not applicable
Hello,

Tools>Macro>VBA Manager

then New
Select AcadProject

Then Visual Basic Editor

Under VBE >Insert>module
Past the code

Goback to Autocad and VBA manager
Select acadProject > Saveas

Then Macros
Select the appropriate Macro then Run

ALL done
0 Likes
Message 5 of 6

Anonymous
Not applicable
Wow, I would have never haven't gotten that. I've used the VBE for Microsoft Office stuff but never in AutoCAD.

Thanks so much to everyone for posting this code and helping me run it!

Tom K.
0 Likes
Message 6 of 6

Anonymous
Not applicable
Hi mfauxock,
It's good tutorial,thanks a lot for you,I'd like that.

wrote in message news:5055873@discussion.autodesk.com...
Hello,

Tools>Macro>VBA Manager

then New
Select AcadProject

Then Visual Basic Editor

Under VBE >Insert>module
Past the code

Goback to Autocad and VBA manager
Select acadProject > Saveas

Then Macros
Select the appropriate Macro then Run

ALL done
0 Likes