Leaderboard
Popular Content
Showing content with the highest reputation on 06/09/2023 in all areas
-
The field pointer is the pointer to the nested field expression (i.e. in this case, the field expression which returns the insertion point coordinate value), and so the field expression would be constructed as follows: (vla-put-textstring Atr1 (strcat "+" "%<\\AcExpr (%<\\AcObjProp Object(%<\\_ObjId " ObjectID ">%).InsertionPoint \\f \"%pt4\">%*.001) \\f ""\"%lu2%pr3""\">%"))2 points
-
Yep 4 hours manual editing of a dwg, now its 2 minutes, the company I did something for could not pay me quick enough. The boss can just not see 5 minutes here and there are suddenly an hour saved. Get on to next project or charge slightly less and get more work.2 points
-
You're welcome. %pt4 obtains a specific coordinate value, %lu2 applies units formatting (similar to LUNITS) and %pr3 applies precision formatting (similar to LUPREC). Since formatting is not required prior to multiplication, I omitted these from the nested field expression.1 point
-
You can not get the field information from 1 block and copy it all that does is gives you the original blocks data, so if you have a lot of point blocks you have to get each attribute field individually. The ID the identifier for the attribute changes with every attribute 10 blocks 2 attributes that is 20 IDS. But your in luck you can say select all the blocks make a table and populate with fields, so move a point the table updates. Looking for best code example I think I have something.1 point
-
Give this a try. If your offset distance is smaller than your block spacing it will not complete the union. (defun c:foo (/ d l ll p1 p2 pl pl2 r s sp ur) ;; RJP » 2023-06-08 (cond ((and (setq d (getdist "\nSpecify offset distance: ")) (setq s (ssget '((0 . "INSERT") (2 . "RECTANGLE_ROUNDED_706")))) (setq sp (vlax-ename->vla-object (cdr (assoc 330 (entget (ssname s 0)))))) ) (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))) (vla-getboundingbox (vlax-ename->vla-object e) 'll 'ur) (mapcar 'set '(p1 p2) (mapcar 'vlax-safearray->list (list ll ur))) (setq l (list (car p1) (cadr p1) (car p2) (cadr p1) (car p2) (cadr p2) (car p1) (cadr p2))) (setq pl (vlax-invoke sp 'addlightweightpolyline l)) (vlax-put pl 'closed -1) (setq r (cons (car (vlax-invoke sp 'addregion (setq pl2 (vlax-invoke pl 'offset d)))) r)) (mapcar 'vla-delete (list pl (car pl2))) ) ) ) (setq pl (car r)) (while (setq r (cdr r)) (vla-boolean pl acunion (car r))) (princ) ) (vl-load-com)1 point
-
Unfortunately, that's the way things are - a dedicated and speedy response or take things slower and get something that might not be exactly what you want. In defence of paying for a LISP, most bosses are reluctant unless you can demonstrate that the cost will give a decent time saving - which is all I want, a few LISPs that gives me 10 minutes extra in the day to make a nice cup of tea,1 point
-
Should be easy to work out, this will give you the vertices of a 3d polyline (google search "3d polyline vertices"): https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/3d-polyline-vertices/td-p/1927067#:~:text=Here're two ways. Using DXF codes vertices are,(cdr (assoc 10 elst)) lst) vtx (entnext vtx) From the list of points do a 'foreach' loop and (command "-insert"..... ) to insert a block - a search will show the syntax for theese Put together to give something like: (defun c:InsBlk ( / poly lst blkname) ;;https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/3d-polyline-vertices/td-p/1927067#:~:text=Here%27re%20two%20ways.%20Using%20DXF%20codes%20vertices%20are,%28cdr%20%28assoc%2010%20elst%29%29%20lst%29%20vtx%20%28entnext%20vtx%29 (defun 3d-coord->pt-lst (lst) (if lst (cons (list (car lst) (cadr lst) (caddr lst)) (3d-coord->pt-lst (cdddr lst)) ) ; end cons ) ; end if ) ; end defun (setq blkname "YourBlockName") ;; define your block name to insert. Could also 'entsel' to pick a block to insert (setq poly (car (entsel))) ;; Select the polyline (setq lst (3d-coord->pt-lst (vlax-get (vlax-ename->vla-object poly) 'Coordinates))) ;; Get the points list from subfunction, above (foreach pt lst ;; for each loop start (command "-insert" blkName pt 1 1 0) ;; insert 'blkname' block (YourBlockName block) ) ; end for each loop ) ; end function You could also look at chainage LISPs some do similar things but just ignore the text creation most have to put in the distances1 point
-
1 point
-
Have a look at this a few changes but will do what you want. https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/dynamically-draw-grid-from-lee-mac/td-p/99503011 point
-
Q1. probably not what you want but create small squares 80x80 & create a grid over the polyline. then use the following lisp. ;;----------------------------------------------------------------------;; ;;DELETE ALL outside Polyline (defun C:PCross (/ SS1 SS2 coords) (setq SS1 (ssget)) ;Select everything (if (setq SS (ssget "_+.:E:S" '((0 . "*POLYLINE")))) ;select polyline (progn (setq coords (vl-remove-if 'not (mapcar (function (lambda (p) (if (= 10 (car p)) (cdr p)))) (entget (ssname SS 0))))) (setq SS2 (ssget "_CP" coords)) (foreach ent (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS2))) (ssdel ent SS1) ) ) ) (foreach ent (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS1))) (entdel ent) ) (princ) )1 point
-
This offers the two possible solutions (defun c:2xd ( / cc1 r1 cc2 r2 dce dxf_210 xi yi i cr1 cr2 vi xt yt h1 h2 h i1 i2 key i) (initget 9) (setq cc1 (getpoint "\nFirst start point?: ")) (initget 9) (setq cc2 (getpoint cc1 "\nSecond start point?: ")) (grdraw cc1 cc2 1) (initget 39) (setq r1 (getdist cc1 "\nFirst length?: ")) (initget 39) (setq r2 (getdist cc2 "\nSecond length?: ")) (grdraw cc1 cc2 0) (setq dce (distance cc1 cc2) dxf_210 (trans '(0 0 1) 1 0 T) ) (if (equal (/ dce (+ r1 r2)) 1E-16) (setq xi (/ (+ (* r2 (car cc1)) (* r1 (car cc2))) dce) yi (/ (+ (* r2 (cadr cc1)) (* r1 (cadr cc2))) dce) i (cons xi (cons yi '(0.0))) ) (if (and (not (zerop (- r1 r2))) (equal (/ dce (+ r1 r2)) 1E-16)) (progn (if (= r1 (max r1 r2)) (setq cr1 cc1 cr2 cc2) (setq cr1 cc2 cr2 cc1) ) (setq xi (/ (- (* (max r1 r2) (car cr2)) (* (min r1 r2) (car cr1))) dce) yi (/ (- (* (max r1 r2) (cadr cr2)) (* (min r1 r2) (cadr cr1))) dce) i (cons xi (cons yi '(0.0))) ) ) (progn (if (or (> dce (+ r1 r2)) (< (+ (min r1 r2) dce) (max r1 r2))) (prompt "\nNo intersection !...") (progn (setq vi (angle cc1 cc2)) (if (> r1 r2) (setq xt (- (/ (* (+ r1 dce r2) (- (+ r1 dce) r2)) (* 2 dce)) r1) yt (- dce xt) h1 (sqrt (- (expt r1 2) (expt xt 2))) h2 (sqrt (- (expt r2 2) (expt yt 2))) xi (/ (+ (* yt (car cc1)) (* xt (car cc2))) dce) yi (/ (+ (* yt (cadr cc1)) (* xt (cadr cc2))) dce) ) (setq xt (- (/ (* (+ r2 dce r1) (- (+ r2 dce) r1)) (* 2 dce)) r2) yt (- dce xt) h1 (sqrt (- (expt r2 2) (expt xt 2))) h2 (sqrt (- (expt r1 2) (expt yt 2))) xi (/ (+ (* xt (car cc1)) (* yt (car cc2))) dce) yi (/ (+ (* xt (cadr cc1)) (* yt (cadr cc2))) dce) ) ) (setq h (/ (+ h1 h2) 2) i1 (polar (cons xi (cons yi '(0.0))) (+ vi (/ pi 2)) h) i2 (polar (cons xi (cons yi '(0.0))) (- vi (/ pi 2)) h) ) (princ "\n<Move cursor> for choice; <Enter>/[Space]/Right-Click for end!.") (while (and (not (member (setq key (grread T 4 2)) '((2 13) (2 32)))) (/= (car key) 25)) (redraw) ; (grdraw cc1 cc2 7) (cond ((eq (car key) 5) (if (< (distance i1 (cadr key)) (distance i2 (cadr key))) (set 'i i1) (set 'i i2) ) (grdraw cc1 i 7) (grdraw i cc2 7) ) ) ) (entmake (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") (cons 67 (if (eq (getvar "CVPORT") 1) 1 0)) (cons 410 (if (eq (getvar "CVPORT") 1) (getvar "CTAB") "Model")) (cons 8 (getvar "CLAYER")) (cons 62 (atoi (getvar "CECOLOR"))) (cons 6 (getvar "CELTYPE")) (cons 370 (getvar "CELWEIGHT")) '(100 . "AcDbPolyline") '(90 . 3) (if (eq (getvar "PLINEGEN") 1) '(70 . 128) '(70 . 0)) (cons 43 (getvar "PLINEWID")) (cons 38 (getvar "ELEVATION")) (cons 39 (getvar "THICKNESS")) (cons 10 (list (car cc1) (cadr cc1))) '(40 . 0.0) '(41 . 0.0) '(42 . 0.0) '(91 . 0) (cons 10 (list (car i) (cadr i))) '(40 . 0.0) '(41 . 0.0) '(42 . 0.0) '(91 . 0) (cons 10 (list (car cc2) (cadr cc2))) '(40 . 0.0) '(41 . 0.0) '(42 . 0.0) '(91 . 0) (cons 210 dxf_210) ) ) ) ) ) ) ) (prin1) )1 point
-
I decided to dig in my office and take a look at house plans that I have from others. I found plans from eight designers & six architects. This is how their plans are done: 4” Studs / o.c. – 7 designers, 1 architect 4” studs / stud face – 1 designer, 1 architect 3.5” studs / o.c. – none 3.5” studs / stud face – 4 architects1 point