Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/23/2024 in all areas

  1. Brilliant stuff @pkenewell, this is brilliant for footpaths, cavity walls and other things I can't think off atm.
    2 points
  2. Something I was playing around with a while back. I use it form time to time. Made a little update yesterday and thought I'd add it here. Will allow you to select a group of objects and store them for later copying. This objects are stored in a global variable and do not have anything to do with the Clipboard. Once you store the objects, you can continue performing any normal functions and when you are ready to have those stored objects to place somewhere else, just execute the command. Call with Copystored or CS Sorry for the choppy video, I had to cut the frames to keep file size down (not sure what's going on with Camtasia). ;;; ------------------------------------------------------------------------ ;;; CopyStored.lsp v1.3 ;;; ;;; Copyright© 08.18.09 ;;; Alan J. Thompson (alanjt) ;;; ;;; Permission to use, copy, modify, and distribute this software ;;; for any purpose and without fee is hereby granted, provided ;;; that the above copyright notice appears in all copies and ;;; that both that copyright notice and the limited warranty and ;;; restricted rights notice below appear in all supporting ;;; documentation. ;;; ;;; The following program(s) are provided "as is" and with all faults. ;;; Alan J. Thompson DOES NOT warrant that the operation of the program(s) ;;; will be uninterrupted and/or error free. ;;; ;;; Allows user to select object(s) for copying (uses first object in ;;; selection for insertion point or specified point) and stores ;;; selection set and insertion point for later usage. ;;; ;;; Express Tools "acet-ss-drag-move" subroutine required. ;;; ;;; Revision History: ;;; ;;; v1.1 (09.29.09) 1. Changed copy method. ;;; 2. Updated error handler ;;; 3. Added AT:SS->List subroutine. ;;; ;;; v1.2 (12.15.09) 1. Updated to account for non WCS (oversite). ;;; ;;; v1.3 (02.23.10) 1. Added check if "acet-ss-drag-move" is loaded. ;;; 2. Added option to specify copy base point. ;;; ;;; ------------------------------------------------------------------------ CopyStored.lsp
    1 point
  3. Here is another old one from ronjonp
    1 point
  4. Try using this modified version of some super old code. I cleanup drawings with this daily. (defun c:endit (/ adoc c e file s) (if (and (= 1 (getvar 'dwgtitled)) (getvar 'writestat)) (progn (acad-push-dbmod) (setq e (getvar 'expert) c (getvar 'cmdecho) file (strcat (getvar 'dwgprefix) (getvar 'dwgname)) adoc (vla-get-activedocument (vlax-get-acad-object)) ) (dictremove (namedobjdict) "ACAD_DGNLINESTYLECOMP") (repeat 3 (setq s (ssget "_X" '((0 . "AEC*,*PROXY*")))) (progn (setvar 'qaflags 1) (vl-catch-all-apply 'vl-cmdf (list "_.explode" s "")) (setvar 'qaflags 0) ) ) (vla-save adoc) (setvar 'expert 5) (setvar 'cmdecho 0) (setvar 'tilemode 1) (if (= 0 (getvar 'worlducs)) (command "_.ucs" "_World") ) (command "_.-wblock" (strcat (getvar 'dwgprefix) (getvar 'dwgname)) "*") (setvar 'expert e) (setvar 'cmdecho c) (acad-pop-dbmod) (if (= 0 (getvar 'cmdactive)) (vl-cmdf "_.close" "_Yes") ) ) (alert "\nThis routine only works on drawings that have been saved or not readonly.") ) (princ) )
    1 point
  5. @3dwannab FYI - I changed the code above again to allow different units, like fractions, architectural, etc. Simple change from using "atof" to convert the strings to using "distof".
    1 point
  6. @3dwannab Thanks! NOTE: I updated the code in my previous post to have better error handling if someone enters an invalid string for the distances. Please re-copy it.
    1 point
  7. @SLW210 Sorry you're right. It conveniently gives you a preview to determine which side. That's something I hadn't thought of! @3dwannab FWIW. I did figure out something with some ingenious ideas from both LeeMac and RonjonP, that make the code pretty short. It may not work perfectly in every instance unless you set your "select offset side" point well out past all the distances you enter (EDIT - I think I solved this). See the code below: ;|============================================================== moff.lsp by Phil Kenewell - 2/23/2024 Description: This routine contain command MOFF, or Multiple Offset. It allows you to enter multiple offset distances, separated by spaces and will offset all those distances to the side you specify. Some code Inspired by: RonJonP: https://www.theswamp.org/index.php?topic=24688.msg297553#msg297553 Lee Mac: https://www.theswamp.org/index.php?topic=32743.0 Last Update: - 2/23/2024: changed using "atof" to "distof" to allow fractions, etc. ===============================================================|; (defun c:moff (/ _strparse ds ob op s t1 t2 tl) ;; Sub function to Parse a string by the specified delimiter. (defun _StrParse (str del / pos) (if (and str del) (if (setq pos (vl-string-search del str)) (cons (substr str 1 pos) (_StrParse (substr str (+ pos 1 (strlen del))) del)) (list str) ) ) ) (if (and (setq ds (getstring t (strcat "\nEnter Distances separated by spaces: <" (if pjk:offdist pjk:offdist "") ">")) ds (if (= ds "") pjk:offdist (setq pjk:offdist ds)) ) (/= ds "") (setq tl (_Strparse ds " ")) (> (apply '+ (mapcar 'distof tl)) 0.0) ) (if (and (setq s (entsel "\nSelect a curve to offset: ")) (setq ob (vlax-ename->vla-object (car s))) ) (if (not (vlax-method-applicable-p ob 'Offset)) (princ "\nInvalid object for Offset. ") (if (setq op (getpoint (cadr s) "\nSelect side to Offset: ")) (progn ;; Make sure the offset side point at the outside of the offset zone. (setq op (polar (cadr s) (angle (cadr s) op) (apply '+ (mapcar 'atof tl)))) ;; iterate for each dist (foreach n (mapcar 'distof tl) (setq t1 (car (vlax-invoke ob "offset" n)) t2 (car (vlax-invoke ob "offset" (- n))) ) (if (< (distance op (vlax-curve-getclosestpointto t1 op)) (distance op (vlax-curve-getclosestpointto t2 op)) ) (vla-delete t2) (vla-delete t1) ) ) ) ) ) ) (progn (setq pjk:offdist nil) (princ "\nInvalid Distances Entered.") ) ) (princ) )
    1 point
  8. A simpler way to accomplish this IMO is to convert the items to a block then use XCLIP.
    1 point
  9. I have moved your thread to the AutoCAD General Forum since it has nothing to do with LISP. Wblock worked here as well. 15kb size problem-Wblock.dwg
    1 point
  10. @3dwannab I'm have been working on a solution that doesn't use command, but it is not as easy as it seems. Determining the side to offset is a different challenge depending on the object selected and whether it is closed or open. I haven't determined a version that works for everything yet. It's MUCH less code just to use the offset command.
    1 point
  11. Change: (vl-sort-i ins '>) to: (vl-sort-i ins '<) And the two instances of: (- bp2 spf) to: (+ bp2 spf)
    1 point
  12. In your sample drawing the lines in this area are 2 arcs, the short joining line is a continuation of arc, see below. Drawing a line perpendicular to the segments and from their mid points, if end 'B' intersects with the others then this forms the arc. My LISP above draws it like this - 2 arcs, no short line If the short line is extended for example then the perpendicular line doesn't intersect at (nearly) the same point as the others, it isn't a part of the arc and so is by-passed in arc creation. Not sure how to program that if there are 2 consecutive arcs and which line to use as the joining line So in the case of the arcs joining you might need to manually remove the line, create arcs and add it back in again? Or do a combination of the earlier LISPs for joined arcs and the one above for all the rest?
    1 point
  13. rlx, Here is function listpol: ;; ; ;; listpol by ymg (Simplified a Routine by Gile Chanteau ; ;; ; ;; Parameter: en, Entity Name or Object Name of Any Type of Polyline ; ;; ; ;; Returns: List of Points in Current UCS ; ;; ;; Notes: On Closed Polyline the Last Vertex is Same as First) ; ;; ; (defun listpol (en / i l) (repeat (setq i (fix (1+ (vlax-curve-getEndParam en)))) (setq l (cons (trans (vlax-curve-getPointAtParam en (setq i (1- i))) 0 1) l)) ) ) Included listpol the following attachment. Also a few changes in delvertex (A little bit more concise) To be complete would need to make sure that it is UCS compliant and maybe a small modification to straight pipe input to remove the requirement of orthomode. ymg Pipe V3.0.lsp
    1 point
  14. Nice idea Alan, I should imagine that it would come in quite handy
    1 point
  15. Shouldn't that have Joe's Name on it? Entire thread here: http://www.theswamp.org/index.php?topic=24646.0;all
    1 point
×
×
  • Create New...