Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/11/2021 in all areas

  1. Rather than debug yours this does what you want just compare, the only difference is it makes a PDF directory rather than delete files. As you can see used since 2014 This version uses Ghostscript and joins all the pdf's into 1 pdf as well as individuals. Rather than delete I would delete the pdf files if exist can use (command "shell" "Del dwgpre\*.pdf") mergepdfs.lsp ;Plots layouts by range ; By Alan H Feb 2014 (defun AH:pltlays ( / val1 val2 plotnames dwgname lendwg pdfname lay numlay numend dwgpre) (SETVAR "PDMODE" 0) (setvar "plottransparencyoverride" 2) (setvar "fillmode" 1) (setvar "textfill" 1) (setq plotnames '()) ; check that pdf directory exists (setq dwgpre (strcat (getvar "dwgprefix") "\pdf")) (if (= (vl-file-directory-p dwgpre) nil) (vl-mkdir dwgpre) ) (SETQ LAYOUTS (vla-get-Layouts (vla-get-activedocument (vlax-get-acad-object)))) (SETQ COUNT (- (VLA-GET-COUNT LAYOUTS) 1)) (if (not AH:getvalsm)(load "Multi Getvals.lsp")) (setq vals (AH:getvalsm (list "Enter plot range" "Enter start tab number" 6 4 "1" "Enter end tab number" 6 4 (RTOS COUNT 2 0)))) (setq numlay (atoi (nth 0 vals))) (setq numend (atoi (nth 1 vals))) (setq len (+ (- numend numlay) 1)) (setq dwgname (GETVAR "dwgname")) (setq lendwg (strlen dwgname)) (setq dwgname (substr dwgname 1 (- lendwg 4))) (repeat len (vlax-for lay LAYOUTS (if (= numlay (vla-get-taborder lay)) (setvar "ctab" (vla-get-name lay)) ) ; if (setq pdfname (strcat dwgpre "\\" dwgname "-" (getvar "ctab") ".pdf" )) ) ; for (setvar "textfill" 1) (setvar "fillmode" 1) (setvar "PLOTTRANSPARENCYOVERRIDE" 2) (COMMAND "-PLOT" "Y" "" "dwg to Pdf" "Iso full bleed A3 (420.00 x 297.00 MM)" "m" "LANDSCAPE" "N" "W" "-6,-6" "807,560" "1=2" "C" "y" "Acad.ctb" "Y" "n" "n" "n" pdfName "N" "y" ) (setq numlay (+ numlay 1)) (setq plotnames (cons pdfname plotnames)) ) ; end repeat (setq trgfile (strcat (getvar "dwgprefix") "pdf\\" dwgname "-D" (nth 0 vals) "-D" (nth 1 vals) ".pdf")) (setq plotnames (reverse plotnames)) (IF (= (length plotnames) 1) (princ) (progn (if (not combinepdf)(load "mergepdfs")) (combinepdf gsExe plotnames trgFile ) ) ) ) ; defun (AH:pltlays) (princ) Multi GETVALS.lsp
    1 point
  2. tombu, You are correct in that you do not need a lisp routine to extend the line. I noticed the OP is using AutoCAD 2016; so do I. For us right clicking on the line's grip does not reveal "Extend" in the context menu. However when I select a grip a box appears with "Stretch" and "Lengthen". Clicking on "Lengthen" and then picking the desired point to which you want to extend the line does exactly what we want. This works regardless of the value of the Z's. As you say easy-peasy!
    1 point
  3. Give this a shot. (defun c:Test (/ s e p a b g x d) ;; Tharwat - 10.Feb.2021 ;; (and (setq s (car (entsel "\nSelect line to extend to desired point : ")) ) (or (= (cdr (assoc 0 (setq e (entget s)))) "LINE") (alert "Invalid object. Please select line object.") ) (or (/= 4 (logand 4 (cdr (assoc 70 (entget (tblobjname "LAYER" (cdr (assoc 8 e))))) ) ) ) (alert (strcat "Select line object resides on a LOACKED layer <!>") ) ) (setq p (getpoint "\nSpecify a point to extend the previously line to : " ) ) (setq a (cdr (assoc 10 e)) b (cdr (assoc 11 e)) g (angle a b) ) (vl-some '(lambda (u) (setq x (inters a b p (polar p (eval u) 1.0) nil)) ) '((+ g (* pi 0.5)) (+ g pi)) ) (setq d (if (< (distance x a) (distance x b)) 10 11 ) ) (entmod (subst (cons d x) (assoc d e) e)) ) (princ) )
    1 point
×
×
  • Create New...