Author Topic: Dimension flip lisp needed  (Read 10569 times)

0 Members and 1 Guest are viewing this topic.

ELOQUINTET

  • Guest
Re: Dimension flip lisp needed
« Reply #15 on: March 21, 2007, 03:32:28 PM »
if it only did it one at a time that would be accepatable. the multiselect is on my wishlist. i appreciate all of the thought you are putting into this.

whdjr

  • Guest
Re: Dimension flip lisp needed
« Reply #16 on: March 21, 2007, 03:45:01 PM »
I got this to work, sometimes.  I haven't figured out why it's not working the other times.  Maybe someone else can jump in on this too.

Code: [Select]
(defun c:diml2r (/ ss ents dim ent mang mpt npt)
 ;converts degrees to radians
 (defun *dtr* (degrees) (* pi (/ degrees 180.0)))
 ;converts radians to degrees
 (defun *rtd* (radians) (* 180.0 (/ radians pi)))
 ;Returns the Dimension entity name
 (defun func (y)
  (vl-remove-if-not
   '(lambda (x)
     (setq x (eq (cdr (assoc 0 (entget x))) "DIMENSION"))
    )
   y
  )
 )
 ;Returns Entity names from a Selection Set.
 (defun *ssnames* (selection_set / num lst)
  (repeat (setq num (sslength selection_set))
   (setq num (1- num)
lst (cons (ssname selection_set num) lst)
   )
  )
  lst
 )
 ;Main Program
 (and (setq ss (ssget '((0 . "DIMENSION,TEXT"))))
      (setq ents (*ssnames* ss))
      (setq dim (car (func ents)))
      (setq ent (entget dim))
      (setq mang (*dtr* (+ (*rtd* (cdr (assoc 50 ent))) 90)))
      (setq
       mpt (mapcar '/
   (mapcar '+ (cdr (assoc 14 ent)) (cdr (assoc 13 ent)))
   '(2.0 2.0 2.0)
   )
      )
      (setq npt (polar mpt mang 1));;<==1 may need to be bigger for dif unit settings.
      (not (command "_.mirror" "P" "" mpt npt "Y"))
 )
 (princ)
)

ELOQUINTET

  • Guest
Re: Dimension flip lisp needed
« Reply #17 on: March 22, 2007, 08:57:28 AM »
yeah will it flipped the dim but not the text the first try then didn't do anything after that hmmm. anyone else care to chime in on this?

GDF

  • Water Moccasin
  • Posts: 2081
Re: Dimension flip lisp needed
« Reply #18 on: March 22, 2007, 02:58:40 PM »
Try these:

Code: [Select]
;;by David Kozina
(defun c:DIMF1  (/ ss i ent ele)
  (prompt "n* Select Dimensions to Flip Text *")
  (setq ss (ssget '((0 . "DIMENSION")))
        i  (1- (sslength ss)))
  (while (not (minusp i))
    (setq ent (ssname ss i)
          ele (entget ent))
    (entmod
      (subst (cons 51 (- (abs (cdr (assoc 51 ele))) PI)) (assoc 51 ele) ele))
    (entupd ent)
    (setq i (1- i))))

;;;by Daniel J. Altamura, R.A.
(defun c:DIMFm (/ DIM_CNT DIM_SS1 DIM_OBJ DIM_ANG)
  (defun DTR (A) (* PI (/ A 180.0)))
  (command ".undo" "group")
  (setq DIM_CNT 0
        DIM_SS1
         (ssget '((0 . "DIMENSION"))))
  (if DIM_SS1
    (progn (repeat (sslength DIM_SS1)
             (setq DIM_OBJ (entget (ssname DIM_SS1 DIM_CNT)))
             (setq DIM_ANG (- (cdr (assoc 51 DIM_OBJ)) (DTR 180)))
             (setq DIM_OBJ (subst (cons 51 DIM_ANG) (assoc 51 DIM_OBJ) DIM_OBJ))
             (entmod DIM_OBJ)
             (princ (strcat "\n* Flipping Dimension Text *"
                            (itoa DIM_CNT)
                            " of "
                            (itoa (sslength DIM_SS1))))
             (setq DIM_CNT (1+ DIM_CNT)))
           (princ (strcat "\n* Flipping Dimension Text *"
                          (itoa DIM_CNT)
                          " of "
                          (itoa (sslength DIM_SS1))))))
  (command ".undo" "end")
  (princ))

Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

GDF

  • Water Moccasin
  • Posts: 2081
Re: Dimension flip lisp needed
« Reply #19 on: March 22, 2007, 03:17:28 PM »
I was wondering if anyone has a lisp for accomplishing what i want or could help me write something? The drawing I have attached has a dimension whose text I want to flip from the right side to the left. I know that I could use the dimtedit command and select the left option but the trick is I want to grab the text below it and flip that as well as shownin the drawing. It would also be nice to have the option to select multiple dimensions as well as the dimtedit command only allows a single. So if anyone has a little time could you help me out with this? Thanks

Dimension flip test

If you want to flip the text below the dimensions in your example, try using the following routine to make this text a part of your dimensions.

;;;Tip1566A:  DIMNOTE.LSP   Dimension Notes   (c)1999, Mike Lapinski

Then when you flip the dimensions everthing will flip.

Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

ELOQUINTET

  • Guest
Re: Dimension flip lisp needed
« Reply #20 on: March 23, 2007, 10:27:00 AM »
Thanks Gary I'll look into this today

ELOQUINTET

  • Guest
Re: Dimension flip lisp needed
« Reply #21 on: March 23, 2007, 10:45:55 AM »
Gary this doesn't exactly suite my needs. See we use a custom routine which draws the elevation as shown in the drawing. I am not adding the text under the dimensions afterward. The drawback of using this routine is that I first have to erase the text placed by our routine then i have to add the text to the individual dimensions as they have different abbreviations and the routine doesn't allow for multiple selection. Is there anything out there which will just put the selected text under the selected dimension?