Author Topic: _measure scaled ?  (Read 1616 times)

0 Members and 1 Guest are viewing this topic.

Andrea

  • Water Moccasin
  • Posts: 2360
_measure scaled ?
« 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.
Keep smile...

DEVITG

  • Bull Frog
  • Posts: 426
_measure scaled ?
« Reply #1 on: December 06, 2004, 05:53:12 PM »
why not scale , and rename the block
Location @ Córdoba Argentina<br /><br />using acad 2008 under win XP

Andrea

  • Water Moccasin
  • Posts: 2360
_measure scaled ?
« Reply #2 on: December 06, 2004, 08:04:47 PM »
Quote from: DEVITG
why not scale , and rename the block


Heun ??

What do you mean ?
how to scale the block ?
Keep smile...

DEVITG

  • Bull Frog
  • Posts: 426
_measure scaled ?
« Reply #3 on: December 07, 2004, 06:21:51 AM »
just scale before use the measure
Location @ Córdoba Argentina<br /><br />using acad 2008 under win XP

SMadsen

  • Guest
_measure scaled ?
« Reply #4 on: December 07, 2004, 07:14:08 AM »
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.

Andrea

  • Water Moccasin
  • Posts: 2360
_measure scaled ?
« Reply #5 on: December 07, 2004, 08:28:41 AM »
thanks SM..

But now, how I can scaled the selected object easely..
do i need to get the DXF code and modify it ?

 :?
Keep smile...

SMadsen

  • Guest
_measure scaled ?
« Reply #6 on: December 07, 2004, 09:32:42 AM »
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.

Andrea

  • Water Moccasin
  • Posts: 2360
_measure scaled ?
« Reply #7 on: December 07, 2004, 12:31:08 PM »
ok thanks.

i will try..

 :wink:
Keep smile...

Andrea

  • Water Moccasin
  • Posts: 2360
_measure scaled ?
« Reply #8 on: December 07, 2004, 05:02:16 PM »
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.
Keep smile...

SMadsen

  • Guest
_measure scaled ?
« Reply #9 on: December 08, 2004, 09:12:01 AM »
Quote from: Andrea
.. 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:

Code: [Select]
(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)
)

Andrea

  • Water Moccasin
  • Posts: 2360
Block Insertion ?
« Reply #10 on: December 08, 2004, 04:15:17 PM »
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.
Keep smile...

Serge J. Gianolla

  • Guest
_measure scaled ?
« Reply #11 on: December 08, 2004, 08:05:58 PM »
Quote from: Andrea
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!

Andrea

  • Water Moccasin
  • Posts: 2360
_measure scaled ?
« Reply #12 on: December 09, 2004, 02:23:18 PM »
Quote from: Serge J. Gianolla
Quote from: Andrea
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.
Keep smile...

Serge J. Gianolla

  • Guest
_measure scaled ?
« Reply #13 on: December 09, 2004, 10:02:42 PM »
De rien, mon ami.