how to make this ucs independent?

Mark Propst

Usenet Archive
Joined
May 2, 2000
Messages
492
Reaction score
0
Here's a simplified snip from a little utility function ;pick a block ;pick a line ;divide line with blocks ;basically the divide command without having to know the block name (defun c:db ( / blk blkname method lin1 which title def ext flags ptinview lastent entlist) (setq blk (car(entsel "\npick a block"))) (setq blkname (getblkname blk));custom func - you get the idea (setq lin1 (car(entsel (strcat "\npick a line to divide with " blkname)))) (setq db:num (g:int "\nenter number of divisions" db:num));custom func - getint with default (command "divide" lin1 "b" blkname "y" db:num)
)

since i'm being lazy and using command, instead of calcing points i thought it would work in non-world ucs but , no! do I have to do it the hard way and calculate points and then try to figure out that trans business finally???

tia
Mark
 
Hi Mark,

Try this, it worked for me, if you tell us wich is the error, it would be usefull.

(defun c:db (/ blk blkname lin1)
(if (not db:num)
(setq db:num 10)
)
(setq blk (car (entsel "\n Pick a block")))
(setq blkname (cdr(assoc 2 (entget blk))))
(setq
lin1 (car (entsel (strcat "\n Pick a line to divide with block " blkname ) ) ) ) (setq db:num (getint (strcat "\n Enter number of divisions: <" (itoa db:num) ">" ) ) ) (command "divide" lin1 "b" blkname "y" db:num) (princ)
)

Saludos

Marco Jacinto
 
Why calculate points and transpose?
Using the segments option, the divide
command creates the points. Just
extract the DXF 10 and DXF 210 for
your block insertion point and rotation
if required.
 
;;why did it not working in non ucs??
(defun c:db ( / blk blkname method lin1 which title def ext flags ptinview lastent entlist) (if (and (setq blk (car (entsel "\npick a block")))(= (cdr (assoc 0 (setq elist (entget blk)))) "INSERT")) (progn (setq blkname (cdr (assoc 2 elist));custom func - you get the idea lin1 (car (entsel (strcat "\npick a line to divide with <" blkname "> "))) ) (if (and lin1 (wcmatch (cdr (assoc 0 (entget lin1))) "LINE,*POLYLINE")) (progn (initget 6) (setq df:num (if (and (= (type db:num) 'INT)(> db:num 1)) db:num 3) db:num (getint (strcat "\nenter number of divisions <"(itoa df:num)"> "));custom func - getint with default db:num (if (and db:num (> db:num 1))(setq df:num db:num) df:num) ) (command "._divide" lin1 "b" blkname "y" db:num) ) (alert "Not a line or a (LW)Polyline") ) ) (alert "Is not a block") ) (princ)
)
 
well, like my version, your version doesn't *always* put the blocks *on* the line I will post a zipped dwg in customer files under subject "Divide test" if you want to check it. Thanks for your efforts.
Mark
 
The zipfile was to large

if you use getpoint or equal command to get a point in UCS you can it transform by the command trans
 
zeha said:
The zipfile was to large

if you use getpoint or equal command to get a point in UCS you can it transform by the command trans

in these routines we weren't using getpoint or equal.
But now I see that even the autocad command "Divide" doesn't work in a non world ucs either so that's why this simple function that calls the command also doesn't work. I hadn't checked that before. Guess I have to rewrite the "Divide" command instead of trying the sleazy easy way of "command"

Thanks again
Mark
 

Latest threads

Back
Top