Jump to content

Leaderboard

Popular Content

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

  1. If you pick a point in paperspace you can go to model space and using a trans function work out where the point is in Model and then try using (ssget pt). Yes does work. Look up help about trans function. (trans pt 3 0)
    1 point
  2. The erase by window can be done, if you look into using SCRIPT, it can do what you want to multiple dwg's, its just take the steps you would do manually and put them into a file. myerasewindow.SCR Open dwg erase objects close and save. Repeat next dwg Hey that is a script !
    1 point
  3. @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
  4. @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
  5. The command to try is foo - ConnectedArc is used by foo as a part of the calculations (Foo is the second code in mine above but you need it all for it to work) If that doesn't work let me know any error messages it returns, thanks (not sure if this LISP is completely error free just now)
    1 point
  6. Version 1.7.0

    3,150 downloads

    This program will calculate the total length of Lines/Polylines/LWPolylines/Arcs/Ellipses/Circles/Splines with an optional filter. The Filter may be used to select only those lines that are on a certain layer, or perhaps have a certain linetype or colour. The results of the calculation can be displayed in an ACAD Table within the drawing, or written to either a CSV or TXT File. The Table-Style may be selected from the drop-down in the main dialog. Main interface The main dialogue box allows the user to filter lines by layer, linetype or colour and select the table style. Multiple selected items can filtered. A filter string may be entered to help the user quickly find the filter items that he/she requires. Options The options dialogue box allows the user to specify which object types should be included and the type of output, table in the drawing, CSV file or TXT file. Demo Function Syntax: LenCal For instructions on how to run the program see here. Any comments, criticism and suggestions are welcome. Either PM me directly, or reply to the original thread.
    1 point
    Excellent utility that does exactly what it's supposed to do and with an intuitive user interface.
    1 point
  7. Reattached last posted lisp... For those that downloaded it (2)... Add this fix at the end of lisp : ... ) ) (if (and lw1 (entget lw1) (not (equal lw1 (entlast)))) (entdel lw1) ) (if (and lw2 (entget lw2) (not (equal lw2 (entlast)))) (entdel lw2) ) (command "_.UCS" "_P") (*error* nil) ) M.R. Sorry for this missed fix... The most recent input ab PLINETOOLS is lwsdvts.lsp posted here : https://www.theswamp.org/index.php?topic=58030.0 HTH. M.R.
    1 point
  8. My latest addition to PLINETOOLS archive... ( 3 missing lisps ... ) They'll divide LWPOLYLINE with equal distances, but make divisions center viewing from each segment of polyline (ending segments may be different than division unit distance, but equal at each end side of segment)... M.R. lws-lins-seg-d-new.lsp lws-segs-seg-d-new.lsp lws-arcs-seg-d-new.lsp
    1 point
  9. Since I've test my codes and they didn't fail in any situations, no matter what orientation of plines and UCS, if they are connected 2 by 2 and are in the same plane, PlPath.lsp won't fail... So, I decided to post these my 4 codes for pline manipulations in one *.zip, since I won't modify them further more... Sincerely, your M.R. [EDIT : ZIP was reattached due to mistake in filtering "POLYLINE" entities in codes plintav.lsp, plav.lsp and pldv.lsp... It were 13+24(1st reattach) downloads till ZIP was reattached again... - Note that these 3 LSP files I mentioned won't work correct if old heavy polyline changed its smoothness (fit/quadratic/cubic)] [EDIT : New ZIP : PLINETOOLS BY MR+GC+LM.ZIP contains : chiv.lsp clpls.lsp convseglws2arcedlws.lsp cseglws2lws.lsp cseglws2lws-lins-b.lsp lws-arcs-seg.lsp (renamed pline-arcs-seg.lsp) lws-arcs-seg-b.lsp lws-arcs-seg-d.lsp lws-arcs-seg-d-b.lsp lws-lins-seg.lsp lws-lins-seg-d.lsp lws-segs-seg.lsp lws-segs-seg-b.lsp lws-segs-seg-d.lsp lws-segs-seg-d-b.lsp plav.lsp pldv.lsp plintav-new.lsp plintav.lsp PlPath.lsp SLWS.lsp It had to be reattached, since numerous modifications among which PlPath.lsp was one... The codes posted are correct, but I suggest that you download archive - not to surf to all this posted links and do copy+paste into notepad... [/EDIT] [EDIT : New addition to PLINETOOLS with additional 3 lisps can be found here : http://www.cadtutor.net/forum/showthread.php?67924-Draw-polyline-along-with-2-or-more-adjacent-closed-polylines/page4&p=#40 [/EDIT] PLINETOOLS BY MR+GC+LM.zip
    1 point
  10. And also have searched for adding and removing vertex to and from polyline... It works also for LWPOLYLINE and old heavy POLYLINE... (defun c:plav ( / add_vtx pt pl flag ) (vl-load-com) (defun add_vtx ( obj add_pt ent_name / bulg sw ew ) (vla-GetWidth obj (fix add_pt) 'sw 'ew) (vla-addVertex obj (1+ (fix add_pt)) (vlax-make-variant (vlax-safearray-fill (vlax-make-safearray vlax-vbdouble (cons 0 1)) (list (car (trans (vlax-curve-getpointatparam obj add_pt) 0 ent_name)) (cadr (trans (vlax-curve-getpointatparam obj add_pt) 0 ent_name)) ) ) ) ) (setq bulg (vla-GetBulge obj (fix add_pt))) (vla-SetBulge obj (fix add_pt) (/ (sin (/ (* 4 (atan bulg) (- add_pt (fix add_pt))) 4)) (cos (/ (* 4 (atan bulg) (- add_pt (fix add_pt))) 4)) ) ) (vla-SetBulge obj (1+ (fix add_pt)) (/ (sin (/ (* 4 (atan bulg) (- (1+ (fix add_pt)) add_pt)) 4)) (cos (/ (* 4 (atan bulg) (- (1+ (fix add_pt)) add_pt)) 4)) ) ) (vla-SetWidth obj (fix add_pt) sw (+ sw (* (- ew sw) (- add_pt (fix add_pt))))) (vla-SetWidth obj (1+ (fix add_pt)) (+ sw (* (- ew sw) (- add_pt (fix add_pt)))) ew) (vla-update obj) ) (setq pl (car (entsel "\nSelect pline entity"))) (if (not (wcmatch (cdr (assoc 0 (entget pl))) "*POLYLINE")) (progn (alert "\nPicked entity isn't polyline - quitting") (exit) ) (if (and (not (< 7 (cdr (assoc 70 (entget pl))) 14)) (eq (cdr (assoc 0 (entget pl))) "POLYLINE")) (if (< (cdr (assoc 70 (entget pl))) 130) (progn (setq flag T) (command "_.convertpoly" "l" pl "") ) (progn (alert "\nYou picked 2d polyline that can't be converted to LWPOLYLINE - quitting") (exit) ) ) (if (not (eq (cdr (assoc 0 (entget pl))) "LWPOLYLINE")) (progn (alert "\nYou picked 3d polyline - quitting") (exit) ) ) ) ) (while (setq pt (getpoint "\nPick point where you want to add vertex to pline - please HIT ENTER to properly end routine")) (setq pt (trans pt 1 0)) (add_vtx (vlax-ename->vla-object pl) (vlax-curve-getparamatpoint pl (vlax-curve-getclosestpointto pl pt)) pl) ) (if flag (command "_.convertpoly" "h" pl "") ) (princ) ) (defun c:pldv ( / AssocOn tang prelst suflst osm pl flag pt par bul ptp parp bulp ptn parn a1 a2 r1 r2 c1 c2 bulpn pll pllp plls plll ) (vl-load-com) (defun AssocOn ( SearchTerm Lst func fuzz ) (car (vl-member-if (function (lambda (pair) (equal SearchTerm (apply func (list pair)) fuzz)) ) lst ) ) ) (defun tang ( a ) (/ (sin a) (cos a)) ) (defun prelst ( lst el / f ) (vl-remove-if '(lambda ( a ) (or f (setq f (equal a el 1e-6)))) lst) ) (defun suflst ( lst el ) (cdr (vl-member-if '(lambda ( a ) (equal a el 1e-6)) lst)) ) (setq osm (getvar 'osmode)) (setq pl (car (entsel "\nPick pline entity"))) (if (not (wcmatch (cdr (assoc 0 (entget pl))) "*POLYLINE")) (progn (alert "\nPicked entity isn't polyline - quitting") (exit) ) (if (and (not (< 7 (cdr (assoc 70 (entget pl))) 14)) (eq (cdr (assoc 0 (entget pl))) "POLYLINE")) (if (< (cdr (assoc 70 (entget pl))) 130) (progn (setq flag T) (command "_.convertpoly" "l" pl "") ) (progn (alert "\nYou picked 2d polyline that can't be converted to LWPOLYLINE - quitting") (exit) ) ) (if (not (eq (cdr (assoc 0 (entget pl))) "LWPOLYLINE")) (progn (alert "\nYou picked 3d polyline - quitting") (exit) ) ) ) ) (setvar 'osmode 1) (while (setq pt (getpoint "\nPick vertex to remove - please HIT ENTER to properly end routine")) (setq pt (trans pt 1 0)) (setq par (vlax-curve-getparamatpoint pl (vlax-curve-getclosestpointto pl pt))) (setq pt (trans pt 0 pl)) (setq bul (cdr (assoc 42 (member (assocon (reverse (cdr (reverse pt))) (entget pl) 'cdr 1e-6) (entget pl))))) (if (and (not (equal par (vlax-curve-getstartparam pl) 1e-6)) (not (equal par (vlax-curve-getendparam pl) 1e-6))) (progn (setq parp (- par 1.0)) (setq ptp (vlax-curve-getpointatparam pl parp)) (setq ptp (trans ptp 0 pl)) (setq bulp (cdr (assoc 42 (member (assocon (reverse (cdr (reverse ptp))) (entget pl) 'cdr 1e-6) (entget pl))))) (if (/= bulp 0.0) (progn (setq a1 (* 4.0 (atan bulp))) (setq r1 (/ (distance ptp pt) (* 2 (sin (* 2 (atan bulp)))))) (setq c1 (polar ptp (+ (angle ptp pt) (- (/ pi 2.0) (* 2 (atan bulp)))) r1)) (if (/= bul 0.0) (progn (setq parn (+ par 1.0)) (setq ptn (vlax-curve-getpointatparam pl parn)) (setq ptn (trans ptn 0 pl)) (setq a2 (* 4.0 (atan bul))) (setq r2 (/ (distance pt ptn) (* 2 (sin (* 2 (atan bul)))))) (setq c2 (polar pt (+ (angle pt ptn) (- (/ pi 2.0) (* 2 (atan bul)))) r2)) (if (and (equal r1 r2 1e-6) (equal c1 c2 1e-6)) (setq bulpn (tang (/ (+ a1 a2) 4.0))) ) ) (setq bulpn 0.0) ) ) (setq bulpn 0.0) ) ) (progn (alert "\nPicked vertex is start-end vertex of pline and can't be removed - quitting") (exit) ) ) (setq pll (entget pl)) (setq pll (append (prelst pll (assocon (reverse (cdr (reverse pt))) pll 'cdr 1e-6)) (cdddr (suflst pll (assocon (reverse (cdr (reverse pt))) pll 'cdr 1e-6))))) (setq pllp (prelst pll (assocon (reverse (cdr (reverse ptp))) pll 'cdr 1e-6))) (setq plls (suflst pll (assocon (reverse (cdr (reverse ptp))) pll 'cdr 1e-6))) (setq plls (subst (cons 42 bulpn) (assoc 42 plls) plls)) (setq plll (append pllp (list (assocon (reverse (cdr (reverse ptp))) pll 'cdr 1e-6)) plls)) (entmod plll) (entupd (cdr (assoc -1 plll))) ) (setvar 'osmode osm) (if flag (command "_.convertpoly" "h" pl "") ) (princ) )
    1 point
×
×
  • Create New...