Author Topic: Dim Mode !!?  (Read 11079 times)

0 Members and 1 Guest are viewing this topic.

nivuahc

  • Guest
Dim Mode !!?
« Reply #15 on: February 21, 2005, 02:35:14 PM »
Did you read the information in the original thread (linked above) that you started?

Andrea

  • Water Moccasin
  • Posts: 2372
Dim Mode !!?
« Reply #16 on: February 21, 2005, 03:28:50 PM »
Quote from: nivuahc
Did you read the information in the original thread (linked above) that you started?


Yes,...but I don't understand all reactor command and variable...
give me 2 or 3 day...   :oops:
Keep smile...

nivuahc

  • Guest
Dim Mode !!?
« Reply #17 on: February 21, 2005, 03:50:24 PM »
mmmkay

Tom

  • Guest
Dim Mode !!?
« Reply #18 on: February 21, 2005, 04:30:56 PM »
This is what we use might help
(defun c:dh  (/ dp1 dp2)
    (setvar "cmdecho" 0)
    (setq oldclayv (getvar "clayer")
     )
    (command "-dimstyle" "r" "wdt_linear001")
    (command "-layer" "s" "wdt-dim" "")
    (prompt "first extension line origin or return to select: ")
    (command "_dim1" "hor" pause pause pause)
    (setvar "clayer" oldclayv)
    (princ)
    )

Andrea

  • Water Moccasin
  • Posts: 2372
Dim Mode !!?
« Reply #19 on: February 21, 2005, 04:56:22 PM »
Quote from: Tom
This is what we use might help
(defun c:dh  (/ dp1 dp2)
    (setvar "cmdecho" 0)
    (setq oldclayv (getvar "clayer")
     )
    (command "-dimstyle" "r" "wdt_linear001")
    (command "-layer" "s" "wdt-dim" "")
    (prompt "first extension line origin or return to select: ")
    (command "_dim1" "hor" pause pause pause)
    (setvar "clayer" oldclayv)
    (princ)
    )


This is not to bad..but only work with Horizontal DIM...
is not exactly what i need..

Just something like...

(while (dimmode ON)
(do nothing)(otherwise reset variables)
)

see ?
Keep smile...

daron

  • Guest
Dim Mode !!?
« Reply #20 on: February 21, 2005, 05:46:37 PM »
Ah! Now if you look at your first post, it is far easier to read. As Sinc said, the text is difficult to read colored blue. At the same time, in Cobalt, red is hard on the eyes. I assume it's just as hard on the eyes in any theme. Andrea, just so you know, before you paste code into the text field, if you type [ code] before...paste code here...[ /code] and after your code, it goes in formatted and pure and no style gives the reader eye damage.

Andrea

  • Water Moccasin
  • Posts: 2372
Dim Mode !!?
« Reply #21 on: February 21, 2005, 06:06:57 PM »
Quote from: Andrea
Quote from: Tom
This is what we use might help
(defun c:dh  (/ dp1 dp2)
    (setvar "cmdecho" 0)
    (setq oldclayv (getvar "clayer")
     )
    (command "-dimstyle" "r" "wdt_linear001")
    (command "-layer" "s" "wdt-dim" "")
    (prompt "first extension line origin or return to select: ")
    (command "_dim1" "hor" pause pause pause)
    (setvar "clayer" oldclayv)
    (princ)
    )


This is not to bad..but only work with Horizontal DIM...
is not exactly what i need..

Just something like...

(while (dimmode ON)
(do nothing)(otherwise reset variables)
)

see ?


By the way....i have modified your routine...
Code: [Select]

(defun c:dh (/ pt1 oldclayv)
(setvar "cmdecho" 0)
(setq oldclayv (getvar "clayer"))

(command "_-dimstyle" "_r" "wdt_linear001")
(if (not (tblsearch "layer" "wdt-dim"))
(command "_-layer" "_n" "wdt-dim" "_c" "4" "wdt-dim" "")  
(command "_-layer" "_s" "wdt-dim" "")
)
(setq pt1 (getpoint  "first extension line origin or return to select: "))
(command "_dim1" "_hor" pt1 pause pause)
(setvar "clayer" oldclayv)

)


you can do similar with dimstyle....so if your dimstyle is not exist..
you can create one by default.
you can also add the linetype in your new layer if not created...
anyway...just for helping..

 8)
Keep smile...

Andrea

  • Water Moccasin
  • Posts: 2372
Dim Mode !!?
« Reply #22 on: February 21, 2005, 06:08:44 PM »
Quote from: Daron
Ah! Now if you look at your first post, it is far easier to read. As Sinc said, the text is difficult to read colored blue. At the same time, in Cobalt, red is hard on the eyes. I assume it's just as hard on the eyes in any theme. Andrea, just so you know, before you paste code into the text field, if you type [code] before...paste code here...[/code] and after your code, it goes in formatted and pure and no style gives the reader eye damage.


thanks, I'll try to remember....but this will not resoved my lisp problem

 :roll:
Keep smile...

nivuahc

  • Guest
Dim Mode !!?
« Reply #23 on: February 21, 2005, 06:11:09 PM »
Do you just want the answers, with no effort on your part whatsoever, Andrea? Is that what you're after?

daron

  • Guest
Dim Mode !!?
« Reply #24 on: February 21, 2005, 06:25:28 PM »
Quote from: Tom
This is what we use might help
(defun c:dh  (/ dp1 dp2)
    (setvar "cmdecho" 0)
    (setq oldclayv (getvar "clayer")
     )
    (command "-dimstyle" "r" "wdt_linear001")
    (command "-layer" "s" "wdt-dim" "")
    (prompt "first extension line origin or return to select: ")
    (command "_dim1" "hor" pause pause pause)
    (setvar "clayer" oldclayv)
    (princ)
    )

Before I begin: Tom, I'm going to critique your code a bit, so please don't take offense. I do this so that we might all put out better code. Believe it or not, people actually sell poorly coded work and get away with it. I'll explain in a bit of rage within the critique.

Okay, here it is. Taking what Tom posted; critiquing it lightly (not to bash or abuse) and adding suggestions. Note: I don't have Autocad while writing this. Here goes anyway:
First line (/ dp1 dp2) There are no variables declared or set. There then seems to be no reason to not do this (). However, there are variables set which should be placed between ( and )

I'm going to step right over the "-dimstyle" command. I don't see how that works at this point.

 (command "-layer" "s" "wdt-dim" "") [exasperated breath mode]Sigh[/ebm] As a programmer, you may think that using "s" is perfectly fine, and if it works it must be, but if someone ever comes to you and says, "Hey, that lisp you gave me didn't work. It told me to tell it what I want to do with the layer command..." don't be hard on him. He didn't know what layer you were trying to hard code. The better used value in this case would be to use "m" ILO "s". Even if the layer exists, it'll only be set, whereas if the layer doesn't exist, it will be made and set, unless you do as you've done and used "s", then you might want to brace yourself for questions. P.S. The reason this topic bothers me sooooooo much at this time more than EVER before, is for the mere fact that at my current employ, I'm forced to use this AWFUL program called AutoCrete. This is someones great idea of selling a product to a bunch of unknowing concrete contractors and making a killing. So, what's stopping me from going into this nuthead's lisp and improving it, you ask????? Well, the bonehead had the nerve to encrypt the one lisp that might mean anything. The actual lsp file is encrypted. It's not fas. Anybody know of a good decrypter? Okay, back on with the critique.

  (command "_dim1" "hor" pause pause pause) I'm not going to guess at what each succesive pause means, but the line before it seems to imply something. Now, since Andre' has need of more than "hor", wouldn't it be wise to setup some sort of user interaction? (initget "Hor Ver Ang") Then, set a variable to catch this solution before and then passing it to the command line. At the same time, more often than not, pause is used as select item or getpoint. If it's to get a point use getpoint set to a variable. If it's to get an entity, use one of the various methods available, i.e. entsel. Then, pass it along in variable form to the command line. Now, you say, "Well, I want to see the dimension on the screen before selecting all the points." Okay, use pause, but minimize the amount of times you use it. I know there are other ways of accomplishing this, but I do want to keep this simple.

Andrea

  • Water Moccasin
  • Posts: 2372
Dim Mode !!?
« Reply #25 on: February 22, 2005, 08:31:57 AM »
Quote from: nivuahc
Do you just want the answers, with no effort on your part whatsoever, Andrea? Is that what you're after?


Not really...in fact I want to understand before.....why ,how, who...
and create one of mine....

But if someone have some samples.....i'll take it..

thanks.
Keep smile...

ELOQUINTET

  • Guest
Dim Mode !!?
« Reply #26 on: February 22, 2005, 08:46:46 AM »
andrea i was using this reactor for awhile which would change the layer to the correspoding dimstyle when the dim command was executed. maybe you can use bits and pieces of it to get you where you wanna go.


Code: [Select]
(vl-load-com)
(vl-load-reactors)
(defun ax:MakeLayer (lName / oLayer)
  (if
    (vl-catch-all-error-p
      (setq oLayer
          (vl-catch-all-apply
            'vla-add
              (list
                (vla-get-layers
                  (vla-get-activedocument
                    (vlax-get-acad-object)
                    )
                  )
                lName
                )
             )
          )
        )
    nil
    oLayer
    )
  )
(vlr-command-reactor
  nil
  '((:vlr-CommandWillStart . StartCommand))
  )
(vlr-command-reactor
  nil
  '((:vlr-commandEnded . EndCommand))
  )
(vlr-command-reactor
  nil
  '((:vlr-commandCancelled . EndCommand))
  )
(defun StartCommand (calling-reactor startcommandinfo / thecommandstart)
  (setq thecommandstart (nth 0 startcommandInfo))
  (cond
    ((= thecommandstart "DIMLINEAR")
      (match:layer)
     )
    ((= thecommandstart "DIMALIGNED")
      (match:layer)
     )
    ((= thecommandstart "QDIM")
      (match:layer)
     )
    ((= thecommandstart "DIMBASELINE")
      (match:layer)
     )
    ((= thecommandstart "QLEADER")
      (match:layer)
     )
    ((= thecommandstart "DIMCONTINUE")
      (match:layer)
     )
    ((= thecommandstart "DIMANGULAR")
      (match:layer)
     )
    ((= thecommandstart "DIMRADIUS")
      (match:layer)
     )
    ((= thecommandstart "DIMDIAMETER")
      (match:layer)
     )
    ((= thecommandstart "DIMORDINATE")
      (match:layer)
     )
    )
  )
(defun EndCommand (calling-reactor endcommandInfo / thecommandend)
  (setq thecommandend (nth 0 endcommandInfo))
  (cond
    ((= thecommandend "DIMLINEAR")
      (EC:MatchLayer)
     )
    ((= thecommandend "DIMALIGNED")
      (EC:MatchLayer)
     )
    ((= thecommandend "QDIM")
      (EC:MatchLayer)
     )
    ((= thecommandend "DIMBASELINE")
      (EC:MatchLayer)
     )
    ((= thecommandend "QLEADER")
      (EC:MatchLayer)
     )
    ((= thecommandend "DIMCONTINUE")
      (EC:MatchLayer)
     )
    ((= thecommandend "DIMANGULAR")
      (EC:MatchLayer)
     )
    ((= thecommandend "DIMRADIUS")
      (EC:MatchLayer)
     )
    ((= thecommandend "DIMDIAMETER")
      (EC:MatchLayer)
     )
    ((= thecommandend "DIMORDINATE")
      (EC:MatchLayer)
     )
    )
  )
(defun match:layer (/ LayerName ex:dimstyle)
  (setq ex:layer (getvar 'clayer))
  (setq ex:dimstyle (getvar 'dimstyle))
  (if (/= ex:layer ex:dimstyle)
    (progn
      (setq LayerName (ax:MakeLayer ex:dimstyle))
      (vla-put-ActiveLayer
        (vla-get-activedocument
          (vlax-get-acad-object)
          )
        LayerName
        )
      (if (not (vlax-object-released-p LayerName))
        (vlax-release-object LayerName)
        )
      (princ)
      )
    )
  )
(defun EC:MatchLayer (/ LayerName)
  (progn
    (setq LayerName (ax:MakeLayer ex:layer))
    (vla-put-ActiveLayer
      (vla-get-activedocument
        (vlax-get-acad-object)
        )
      LayerName
      )
    (if
      (not
        (vlax-object-released-p LayerName)
        )
      (vlax-release-object LayerName)
      )
    (setq ex:layer nil)
    (princ)
    )
  )

Andrea

  • Water Moccasin
  • Posts: 2372
Dim Mode !!?
« Reply #27 on: February 24, 2005, 11:08:19 AM »
Quote from: nivuahc
Do you just want the answers, with no effort on your part whatsoever, Andrea? Is that what you're after?



hmmm....I have revised my decision....

I need the anwer....

I'm trying to understand the reactor...nut don't know if i'm going in the good way....and I need any solution for doing that...

I need to detect the DIM command..

(when dim activated) (do this)
(when dim stopped) (do that)

so i need to change the layer of any dimension without remaking all dimension command.

so in a Acad button to have somthing similar to..

(changelayerbefore)^c^c_QDIM;(resetlayerafter)

or

^c^c_QDIM;(change last in specific layer)

can I do this easily ?

Help needed....

thanks.

(sorry for my english. :oops:
Keep smile...

ronjonp

  • Needs a day job
  • Posts: 7529
Dim Mode !!?
« Reply #28 on: February 24, 2005, 01:34:00 PM »
Take a look here....not lisp but it works great:

http://theswamp.org/phpBB2/viewtopic.php?p=33933#33933

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Andrea

  • Water Moccasin
  • Posts: 2372
Dim Mode !!?
« Reply #29 on: February 24, 2005, 03:56:49 PM »
I have created this...

Hi


Code: [Select]
(defun dim1_mode ()

(setvar "cecolor" 4))
(setvar "clayer" "dimensions")
 
(while (= 1 (getvar "cmdactive"))
(command pause)
(progn
  (command "cecolor" (getvar "cecolor"))
  (command "clayer" (getvar "clayer"))
)); end while
(princ)
)))


so i have modified a button...for exemple..
^C^C^P_dimlinear;(dim1_mode)

work well...but lot of error message..

also...this is not working when using...QDIM or DIMBASELINE or DIMCONTINUE   etc..

any help ?
Keep smile...