How to obtain the object ID of an specific linetype?

How to obtain the object ID of an specific linetype?

Anonymous
Not applicable
1,229 Views
2 Replies
Message 1 of 3

How to obtain the object ID of an specific linetype?

Anonymous
Not applicable

Hello,

Could somebody let me know how to obtain the object ID in lisp of an specific line type to then pass it as an argument vla-SetGridLineType?

I need this to format the grid lines on a table.

 

For instance, If I manually format the table to use the "HIDDEN2" as line type for the outer border and then I execute:

 

 (vla-GetGridLineType TblObj 0 1 acHorzTop) 

I get the object ID for the "HIDDEN2" line type used. However I know it is not a simple numeric value but an object ID as mentioned.

 

If instead I execute:

 

(setq objLT (vla-GetGridLineType TblObj 0 1 acHorzTop))

Then I can use objLT variable storing the linetype ID to pass to the following lines of code to format subsequent grid lines like this:

(vla-SetGridLineType TblObj 1 1 acHorzBottom objLT)
(vla-SetGridLineType TblObj 2 1 acHorzBottom objLT)

; etc, etc, etc.

 

But without first manually formatting the table with the wanted linetype, I have not been able to get the object ID of the line type I want to use.

 

What lisp function (or series of functions) can I use to obtain the object ID of an specific line type just by name?

 

Can somebody shed some light here?

Thank in advance.

0 Likes
Accepted solutions (1)
1,230 Views
2 Replies
Replies (2)
Message 2 of 3

_gile
Consultant
Consultant
Accepted solution

 

Hi,

 

Try this:

 

(setq objLt(vla-get-ObjectId (vla-Item (vla-get-Linetypes (vla-get-ActiveDocument (vlax-get-acad-object))) "HIDDEN2")))

 



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 3 of 3

Anonymous
Not applicable

That worked.

 

Thanks Gilles. Much appreciated.

0 Likes