TheSwamp
CAD Forums => CAD General => Topic started by: Andrea on December 06, 2004, 05:10:07 PM
-
Hi all..
i'm tryin to make a simple lisp routine to _measure a line with insertion block.
but i would like to know how to insert this block proportionaly scaled to a "X" factor...
beacause ther is no option to put the scale of this block..
any idea ??
tx.
-
why not scale , and rename the block
-
why not scale , and rename the block
Heun ??
What do you mean ?
how to scale the block ?
-
just scale before use the measure
-
MEASURE puts the inserted blocks into the previous selection set so, if you have grips on, you can select them and change scales in the properties window.
E.g. (sssetfirst nil (ssget "P")) will grip the blocks.
-
thanks SM..
But now, how I can scaled the selected object easely..
do i need to get the DXF code and modify it ?
:?
-
If you're gonna do it programmatically, yes.
If you're using MEASURE within a COMMAND function then you might need to halt the routine until you're sure that the previous selection set has been created (then again, you might not - I haven't tried it). Then grab (ssget "P"), run through it and modify code 41/42/43 to change the scale.
-
ok thanks.
i will try..
:wink:
-
OK..
I can't get the solution....
the problem is...
I nead to modify a line by using the MEASURE command by selecting the line and make a _MEASURE of it with the Block options at "X" distance.
so:
(setq b1 (getstring "Name of block")
b2 (getreal "Distance")
b3 (getvar "ltscale"))
I need to _MEASURE a selected line with the "b1" Block at "b2" distance...
but i bon't know how to scale the "b1" block to be proportionaly scaled as the LTSCALE factor....
I have modified the 41 42 and 43 DXF group code..but it take only one of the Measuring Block so i need to make a "While" and than complicate the program..but I don't want to use this option..
I know i can make a new linetype..
but some client don't want to use it... :?
any help here will be appreciated.
-
.. but i bon't know how to scale the "b1" block to be proportionaly scaled as the LTSCALE factor....
I'm not sure about that either - sounds like a case of reading the linetype definition if you're trying to emulate a complex linetype - but once you figure out what you need as a scaling factor, the procedure itself should be straightforward. Something like this:
(defun measureLine (/ a b1 b2 ent entl scale sset)
(cond ((and (setq ent (entsel "\nLine to divide: "))
;; the scale should probably be derived from your ltype
;; definition but for clarity it's just a user input here
(setq scale (getreal "\nScale factor: "))
(tblsearch "BLOCK" (setq b1 (getstring "Name of block: ")))
(setq b2 (getdist "Distance: "))
)
;; measure the thing
(command "_MEASURE" ent "Block" b1 "Yes" b2)
;; get the blocks inserted by MEASURE (should verify for success here!)
(setq sset (ssget "P") a 0)
;; run through each block and apply scale factors
(repeat (sslength sset)
(setq ent (ssname sset a)
entl (entget ent)
a (1+ a))
(mapcar '(lambda (dxf)(setq entl (subst (cons dxf scale)(assoc dxf entl) entl)))
'(41 42 43))
(entmod entl))
)
)
(princ)
)
-
Hey !! SM..!!
It work like a charm...
thanks..
Another little question...
How can Inset the B1 block if is not in the drawing.?
I've made this..
(setq b1 (getstring "Block name: "))
(setq sb1 (tblsearch "BLOCK" b1))
(if (not sb1)(vl-cmdf "_.insert" (strcat "x:/meca/symboles/MM_" b1 ".dwg") "0,0" "" "" ""))
in this drawing I have the B1 block.
and it work well.
but now i can't purge-it..
so the question is...
is there a way to insert a block without using the INSERT command ?
or insert the block and cancel before complete insertion ?
I don't want to insert it in the drawing and than remove-it just to have this block in the drawing..
any idea ??
thanks.
-
or insert the block and cancel before complete insertion ?
(command "_.INSERT" "SectMark" ^C)
You are using ObjectDCL. In it you will find a function loading blocks from a dwg too!
-
or insert the block and cancel before complete insertion ?
(command "_.INSERT" "SectMark" ^C)
You are using ObjectDCL. In it you will find a function loading blocks from a dwg too!
Que ferais-sans toi.... :D
thanks.
-
De rien, mon ami.