Jump to content

Lisp for dimension continúe of multiple selected lines. Need help


Neburorama

Recommended Posts

;  **********************************

(defun chkdims_err (s)                 ; If an error (such as CTRL-C <ESC>) occurs,
(if (/= s "Function cancelled")
    (princ (strcat "\nError: " s))
)
; VARIABLE RESETS AND COMMANDS TO PERFORM UPON ERRORS FOLLOW:,
(SETVAR "SNAPMODE" SNP)
(SETVAR "OSMODE" OS)
(SETVAR "ORTHOMODE" ORTH)
(if olderr (setq *error* olderr))  ; Restore old *error* handler,
(princ)
);;defun,
;************************************************ MAIN PROGRAM **********************
;************************************************************************************,
(defun c:DiMRAH (/ olderr snp os orth cot1 a Lyns n index Ln1 Ln2 Lst1 Lst2 Pt1 Pt2
         ang Pt1a tipe )
  ;VARIABLES TO SAVE FOR ERROR HANDLER FOLLOW:,
  (setq    snp (getvar "snapmode")
    os  (getvar "osmode")
    orth(getvar "orthomode")
        )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;,
      (setvar "snapmode"  0)
      (setvar "osmode"    0)
      (setvar "orthomode" 1)
;;;*******************************************************************************,

  (if (= gvr nil)
        (setq gvr 1.0)
    );end if,
    (princ "\nDistancia entre Cota y Linea:<")
    (princ gvr)
    (princ "> ")
    (setq a (getdist))
    (if (= a nil)
        (setq a gvr)
    );end if,

    (setq gvr a)
;;;  ****************************************************************************,
  (PROMPT "Select lines or <Fence> ")
  (setq    Lyns (ssget)
    n    (sslength Lyns)
    index 0
    )                ;cierra setq,
     (repeat (- n 1)
      (setq    Ln1      (ssname Lyns  index);
        Ln2      (ssname Lyns (+ 1 index));
        Lst1     (entget Ln1)
        Lst2     (entget Ln2)
        Pt1      (cdr (assoc 10 Lst1))
        Pt2      (cdr (assoc 10 Lst2))
        index    (+ 1 index)
        ang     (angle Pt1 Pt2)
        Pt1a  (list
             (- (car pt1) a) (+ (cadr pt1) a );
             )
          )                ;cierra setq,
;;;****************************************************************************,
  (cond
    (
     (or
       (= ang   0.0 )
       (= ang 180.0 )
     )
     (setq tipe "HOR")
    )
    (
     (or
       (= ang 90.0 )
       (= ang 270.0)
     )
     (setq tipe "VER")
    )
    (
     T
     (setq tipe "ALI")
    )
  )    
;;;*****************Acotaciones********************************************,
    (command "_dimlinear" pt1 pt2 pt1a )      ;
       )                ;
;;;****************************************************************************,
  (setvar "snapmode"  0)        ;
  (setvar "osmode"   39)
  (setvar "orthomode"  0)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;,
  (setq *error* olderr)              ; 
(princ)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;,
(PRINC)
)
;;;;;;;;;;;;,

 

Edited by SLW210
Added Code Tags!!
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...