satishrajdev Posted October 25, 2012 Posted October 25, 2012 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 Quote
MSasu Posted October 25, 2012 Posted October 25, 2012 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. Quote
nod684 Posted October 25, 2012 Posted October 25, 2012 (edited) 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 October 25, 2012 by nod684 Quote
MSasu Posted October 25, 2012 Posted October 25, 2012 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. Quote
satishrajdev Posted October 25, 2012 Author Posted October 25, 2012 @Msasu And @nod684 It is working perfectly, Thanx a lot for your time i got exactly i wanted.... Quote
Recommended Posts
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.