Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/31/2023 in all areas

  1. The following offers another method using a temporary saved view - the advantage being that the user can adjust the view plane in addition to zooming & panning: (defun c:test ( / *error* doc idx obj vpo vwc vwn ) (defun *error* ( msg ) (if (and (= 'vla-object (type obj)) (vlax-write-enabled-p obj)) (vla-delete obj) ) (if (and msg (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*"))) (princ (strcat "\nError: " msg)) ) (princ) ) (setq doc (vla-get-activedocument (vlax-get-acad-object)) vwc (vla-get-views doc) idx 0 ) (while (itemp vwc (setq vwn (strcat "$temp" (itoa (setq idx (1+ idx))))))) (setq obj (vla-add vwc vwn) vpo (vla-get-activeviewport doc) ) (foreach prp '(center direction height target width) (vlax-put-property obj prp (vlax-get-property vpo prp)) ) (getpoint "\nPan & zoom around...") (vla-setview vpo obj) (vla-put-activeviewport doc vpo) (*error* nil) (princ) ) (defun itemp ( col key ) (not (vl-catch-all-error-p (vl-catch-all-apply 'vla-item (list col key)))) ) (vl-load-com) (princ)
    2 points
  2. There is also vla-zoomprevious
    1 point
  3. (setq vc (getvar 'viewctr)) (setq sz (getvar 'viewsize)) .... (setq Drawing (vla-get-activedocument (vlax-get-acad-object))) (vla-zoomcenter Drawing VC SZ);recal zoom location vla way
    1 point
  4. Also here is the Autodesk lisp commands. https://help.autodesk.com/view/ACD/2024/ENU/?guid=GUID-4CEE5072-8817-4920-8A2D-7060F5E16547 So you can look up the difference between command & command-s. While command is the simplest to programming it should be pointed out its very clunky and slow compared to lisp functions. their is usually multiple ways to do things in lisp. This is the entmake way of make a layer. this won't output anything to the command line thus cutting down on spam. (entmake '((0 . "LAYER") (100 . "AcDbSymbolTableRecord") (100 . "AcDbLayerTableRecord") (2 . "Text") (70 . 0) (62 . 3)))
    1 point
  5. When posting if you use capitals it is known as speaking loudly. Post a sample dwg or at least an image so we can see what you want.
    1 point
  6. Try this, using getvars VIEWCTR X= 55522.1809 Y= 63040.4178 Z= 0 (Read Only) VIEWSIZE 18655.3206 (Read Only) commands ZOOM C pt Scale ZOOM C viewctr viewsize You could make continuous variables as a list (roomnum 55522.1809 63040.4178 18655.3206) maybe save as Ldata then can zoom room 2. Ldata supports saving a list. (VLAX-PUT-LDATA "STEVEN" "view" rooms) (VLAX-GET-LDATA "STEVEN" "view")
    1 point
  7. You would be better off delete the rectangle you don't want and redrawing using the side of the exiting rectangle as a refrence. Modified from here to ask for two points (side of rectangle) then will ask for left or right side and a distance to draw a rectangle perpendicular to the first two points. (defun c:BX (/ foo dist p1 p2 p3 ang) ;; Draw rectangle based on 2 or 3 picked points ;; Alan J. Thompson, 07.26.10 ;; modified by mhupp pick two points a side an distance (defun foo (l) (entmake (append '((0 . "LWPOLYLINE") (100 . "AcDbEntity") (100 . "AcDbPolyline") (90 . 4) (70 . 129)) (mapcar (function (lambda (p) (cons 10 (reverse (cdr (reverse (trans p 1 0))))))) l) ) ) ) (if (and (setq p1 (getpoint "\nSpecify first point: ")) (setq p2 (getpoint p1 "\nSpecify second point: ")) (setq p3 (getpoint (mapcar '/ (mapcar '+ p1 p2) '(2 2 2)) "\nLeft or Right: ")) ) (progn (setq dist (getdist "\nLength of side: ")) (if (sin (- (angle p1 p3) (angle p1 p2))) (setq ang (+ (* pi 1.5) (angle p1 p2))) (setq ang (+ (/ pi 2.) (angle p1 p2))) ) ) ) (if (and p1 p2 ang dist) (foo (list p1 p2 (polar p2 ang dist) (polar p1 ang dist))) ) (princ) ) bx command.mp4
    1 point
  8. I TRY OVERKILL AND ITS NOT GIVE ANY CORRECTION..
    1 point
×
×
  • Create New...