View Full Version : Using MLine in lisp
ReachAndre
2007-04-10, 03:37 PM
Hello all,
I am trying to use Mline in my lisp routine. Lets just say it so far look ssmething like this
(defun c:cool (/ currlay)
(setq currlay (getvar "clayer"))
(c:mline)
(setvar "clayer" currlay)
(princ "thanks all"))
thank you all in advance,
Andre
What do you want to do with the mline?
Are you just trying to create it or do something with it?
ReachAndre
2007-04-10, 04:13 PM
really just trying to create it then explode it into just lines
looks a little closer to this
(defun c:ddcf ()
(setq currlay (getvar "clayer"))
(setq scale (getdist "Scale: "))
(command "mline" "s" scale "j" "z" "")
(c:mline)
(command "explode" (entlast) "")
(princ))
Thansk in advance again
Andre
Well I got further with it.
this only allows you to pick 2 points for your mline.
(defun c:ddcf ()
(setq currlay (getvar "clayer"))
(setq scale (getdist "Scale: "))
(SETQ lr1 (TBLSEARCH "LAYER" "MLINE"))
(IF (= LR1 NIL)
(COMMAND "LAYER" "MAKE" "MLINE" "COLOR" "4" "" ""))
(command "layer" "set" "mline" "" "")
(command "mline" "scale" scale "style" "" pause pause pause "")
(command "explode" (entlast) "")
(setvar "clayer" currlay)
(princ))
I'll look into being able to pick more points.
Are you going to close it like a polyline?
I'll bet there's gurus out there who can improve on it!
ReachAndre
2007-04-10, 05:07 PM
no, I dont plan on closing it, its more right now for pipe routing lines taht I want to stay a set distance apart.
no, I dont plan on closing it, its more right now for pipe routing lines taht I want to stay a set distance apart.Ok, here's another vesion.
It uses points you pick on the screen using "blipmode", I got it from another routine I have.
The problem is you can't use ortho [F8] in this, or atleast I don't know how yet.
(defun c:ddcf (/ pts currlay)
(setq blips (getvar "blipmode"))
(setq currlay (getvar "clayer"))
(setq scale (getdist "Scale: "))
(SETQ lr1 (TBLSEARCH "LAYER" "MLINE"))
(IF (= LR1 NIL)
(COMMAND "LAYER" "MAKE" "MLINE" "COLOR" "4" "" ""))
(command "layer" "set" "mline" "" "")
(command "blipmode" "on")
(setq pts ())
(while
(setq pt (getpoint "\nSelect Point:"))
(setq pts (cons pt pts))
)
(command "mline" )
(foreach item pts
(command item)
)
(command "")
(setvar "blipmode" blips)
(command "redraw")
(command "explode" (entlast) "")
(setvar "clayer" currlay)
(setq pts_l(length pts))
(setq msg (strcat "\nProcessed "(itoa pts_l)"Points:"))
)
But you can pick as many points on the screen you want.
Hope this helps or steers you in the right direction.
jwanstaett
2007-04-10, 09:39 PM
??? Why are you explode the mline ???
ReachAndre
2007-04-11, 01:52 PM
The only reason I am exploding the mline is because of company standard not being mlines. Not my call, but I dont have that much clout here yet.
jwanstaett
2007-04-11, 02:07 PM
The only reason I am exploding the mline is because of company standard not being mlines. Not my call, but I dont have that much clout here yet.be for mline autocad had a list program call DLINE that dose what your are trying to do look he
http://www.autocadtrainerguy.com/AutoCAD_Stuff/AutoCADStuff.htm
Powered by vBulletin® Version 4.1.11 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.