Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/19/2023 in all areas

  1. If you are using this in a routine you might want to add in a few details - takes a moment to add them once and will be there each time. A quick check first that you are getting a PDF but just without the preview. I copied and pasted your line of code and had to add in "dwg to PDF" for the plotter (add your own preferences) - the sheet I was using didn't have a plotter assigned to it - but afterwards it did it as expected, with a preview. Might be something simple like that. (command "PLOT" "Y" "" "Dwg to PDF" ""...... For my PDF routines I tend to specify everything earlier in the routine rather than using "" and put in the variables in the command line - it reduces the number of errors and covers things like the page setup not being set up
    1 point
  2. Worked for me made a pline then ... (command "wipeout" "P" (entlast) "Y") ; Y or N
    1 point
  3. Thanks, @marko_ribar and @Steven P. I like how the built-in UCS command handles a picked object. Depending on which side of a polyline or line segment you pick determines the orientation of the new UCS. So I came up with the idea of retrieving the previous window coordinates before the UCS command was issued. With help from a fn from Lee Mac of course. This gets it close enough to where I need to be after running the UCS command and not send me into outer space after running the plan command. GIF and code: ;; ;; Restores the zoomed in window after running the command "UCS" "_OB" followed by the plan command ;; Written on 2023.07.18 by 3dwannab ;; LM:ViewportExtents by Lee Mac (THANKS AGAIN) ;; (defun c:I_LIKE_TO_ZOOM_IT_ZOOM_IT (/ *error* acDoc LM:ViewportExtents pt1 pt2 vp_pts) (vl-load-com) ;; Viewport Extents - Lee Mac ;; Returns two WCS points describing the lower-left and ;; upper-right corners of the active viewport. (defun LM:ViewportExtents (/ c h v) (setq c (trans (getvar 'viewctr) 1 0) h (/ (getvar 'viewsize) 2.0) v (list (* h (apply '/ (getvar 'screensize))) h) ) (list (mapcar '- c v) (mapcar '+ c v)) ) (defun *error* (errmsg) (and acDoc (vla-EndUndoMark acDoc)) (and errmsg (not (wcmatch (strcase errmsg) "*CANCEL*,*EXIT*")) (princ (strcat "\n<< Error: " errmsg " >>\n")) ) ) (setq acDoc (vla-get-ActiveDocument (vlax-get-acad-object))) (or (vla-EndUndoMark acDoc) (vla-StartUndoMark acDoc)) (setq vp_pts (LM:ViewportExtents)) (command "ucs" "_OB" pause "plan" "") (setq pt1 (vlax-3d-point (car vp_pts))) (setq pt2 (vlax-3d-point (cadr vp_pts))) ; Restores the portion of the screen you were originally in (vla-ZoomWindow acadObj pt1 pt2) (vla-EndUndoMark acDoc) (*error* nil) (princ) ) (c:I_LIKE_TO_ZOOM_IT_ZOOM_IT)
    1 point
  4. Thanks! Such a quick answer. There was a tiny error for y1 (you use x1 and x2 again but with my limited knowledge of LSP I updated it to y1 and y2 and it worked!) I'll dissect the code and see if i can learn some LISP as this saves me quite some time!
    1 point
  5. You gave simple example, thus it was not hard to construct WIPEOUT through (entmake)... So for complex ones, I strongly suggest that you use first code which will convert lwpolyline into wipeout with the same characteristics... (defun c:makewipeout ( / vertexList lw ) (setq vertexList (list (list -1 -1 0.) (list 1 -1 0.) (list 1 1 0.) (list -1 1 0.) ) ) (setq lw (entmakex (append (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") (cons 8 "0") '(100 . "AcDbPolyline") (cons 90 (length vertexList)) (cons 70 (1+ (* 128 (getvar 'plinegen)))) (cons 38 0.0) ) (mapcar '(lambda ( pt ) (cons 10 pt)) vertexList) (list (list 210 0.0 0.0 1.0)) ) ) ) (vl-cmdf "_.WIPEOUT" "_P" lw "_Yes") (princ) ) Or alternatively using (entget (car (entsel))) from previously generated WIPEOUT : ((-1 . <Entity name: 4ac03910>) (0 . "WIPEOUT") (5 . "AA") (330 . <Entity name: 4a5381c0>) (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (100 . "AcDbWipeout") (90 . 0) (10 -1.0 -1.0 0.0) (11 2.0 0.0 0.0) (12 0.0 2.0 0.0) (13 1.0 1.0 0.0) (70 . 7) (280 . 1) (281 . 50) (282 . 50) (283 . 0) (71 . 2) (91 . 5) (14 -0.5 0.5 0.0) (14 0.5 0.5 0.0) (14 0.5 -0.5 0.0) (14 -0.5 -0.5 0.0) (14 -0.5 0.5 0.0) (290 . 0)) (defun c:makewipeout ( / vertexListmain vertexList ) (setq vertexListmain (list (list -1 -1 0.) (list 1 -1 0.) (list 1 1 0.) (list -1 1 0.) ) ) (setq vertexList (mapcar '(lambda (x) (mapcar '(lambda (y) (/ y 2.0)) x)) vertexListmain)) (entmake (append (list (cons 0 "WIPEOUT") (cons 100 "AcDbEntity") (cons 100 "AcDbWipeout") (cons 90 0) (cons 10 (car vertexListmain)) (cons 11 (mapcar '- (cadr vertexListmain) (car vertexListmain))) (cons 12 (mapcar '- (caddr vertexListmain) (cadr vertexListmain))) (cons 13 (caddr vertexListmain)) (cons 70 7) (cons 280 1) (cons 281 50) (cons 282 50) (cons 283 0) (cons 71 2) (cons 91 5) ) (mapcar '(lambda (p) (cons 14 p)) (append vertexList (list (car vertexList)))) (list (cons 290 0)) ) ) (princ) ) HTH., M.R.
    1 point
×
×
  • Create New...