Jump to content

Draw a line with color line type and layer


satishrajdev

Recommended Posts

Hi all,

I need a small help from you, i want to draw a line which must have following properties:-

Color - Red

Linetype - dashed

Layer - Match Line

 

Is there any code which can draw a line automatically with this properties.

for a reference i have see the attached drawing file

 

Thanx a lot

 

Regards

test.dwg

Link to comment
Share on other sites

There are two methods available:

  • By calling commands:

(command "_LINE" '(0.0 0.0 0.0) '(10.0 10.0 0.0) "" 
        "_CHPROP" "_L" "" "_LA" "DASHED" "_C" 1 "_LT" "DASHED" "")

  • By addign the entity's list into database directly:

(entmakex '((0 . "LINE") (10 0.0 0.0 0.0) (11 10.0 10.0 0.0)
           (8 . "DASHED") (62 . 1) (6 . "DASHED")))

 

 

For sure, need to validate before the availability of the layer and linetype into drawing.

Link to comment
Share on other sites

Hi all,

I need a small help from you, i want to draw a line which must have following properties:-

Color - Red

Linetype - dashed

Layer - Match Line

 

Is there any code which can draw a line automatically with this properties.

for a reference i have see the attached drawing file

 

Thanx a lot

 

Regards

 

like this?

 


(defun C:test (/ startpt endpt)
(setq orth (getvar 'orthomode))
(setq old_clay (getvar 'clayer))
(command ".-linetype" "load" "dashed" "" "" "")
(if(not(tblsearch "LAYER" "MatchLine"))
   (command "-layer" "new" "MatchLine" "C" "1" "MatchLine" "Ltype" "dashed" "MatchLine"  )
)
(command "-layer" "set" "MatchLine" "")
 (terpri)
(setvar 'orthomode 1)
(setq startpt (getpoint "Starting Point:"))
 (terpri)
(setq endpt (getpoint "End Point :"))
(command "_line" startpt endpt "" )
(setvar 'clayer old_clay)
(setvar 'orthomode orth)
(princ)
)

Edited by nod684
Link to comment
Share on other sites

For sure this is an alternative, to draw the entity and let it retrive current environment's features, but please don't forget that a good programming practice is to restore user's environment if you affected it. That it, store the current layer into a variable and restore it after draw actions are done.

Link to comment
Share on other sites

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...