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

Line type Creating with Vba

4 REPLIES 4
Reply
Message 1 of 5
Shanskvm
2580 Views, 4 Replies

Line type Creating with Vba

How can create in vba with line type ?

 

Thanks

shan

Tags (2)
4 REPLIES 4
Message 2 of 5
norman.yuan
in reply to: Shanskvm

By "Creating", do you mean using VBA code dynamically to create a line type file (*.lin) from nothing and then load it into AutoCAD, or just load a line type from an existing *.lin?

 

I'd assume it is the latter. So, look into AcadLineTypes.Load(<linet type name>, <*.lin file name>). There is code examples in Acad VAB help.

Norman Yuan

Drive CAD With Code

EESignature

Message 3 of 5
Shanskvm
in reply to: norman.yuan

I need to create layer with line type.

How to create through vba.

 

Thanks

shan

Message 4 of 5
norman.yuan
in reply to: Shanskvm

Something like:

 

Dim myLayer As AcadLayer

Set myLayer=ThisDrawing.Layers.Add("MyLayer")

myLayer.LineType="Continuous" '(or other line type name)

...

'Set other layer properties

...

 

Of course, myLayer.LineType can only be set to a name of line type that has been loaded. If you set it to the name of a line type that has not been loaded (i.e. line type defined outside acad.lin), you have to make sure the corresponding *.lin file is loaded. You can examine ThisDrawing.LineTypes to find out what line types has been loaded. If the target line type is not there, you then use ThisDrawing.LineTypes.Load() to load the *.lin file that contains the target line type definition.

 

HTH

Norman Yuan

Drive CAD With Code

EESignature

Message 5 of 5
Shanskvm
in reply to: Shanskvm

when i can run same code.different layer erros coming .how i can solve ?

 

Thanks

shan

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

Post to forums  

Autodesk Design & Make Report

”Boost