Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/27/2021 in all areas

  1. Thanks guys for adding linetype check. ; error : Automation Error 80200025; [IAcadLWPolyline] Error accessing [LINETYPE] property. ErrIndex=0; Invalid Symbol Table name Acad= Acad.lin Acadiso.lin Bricscad= Default.lin Use (vlax-product-key) to work out which software. A simple request becomes complicated. (if(tblsearch "ltype" "PHANTOM") (princ) (progn (if (wcmatch (vlax-product-key) "*BricsCAD*") (setq linetypename "Phantom" filename "Default.lin") (setq linetypename "Phantom" filename "Acad.lin") ) (vl-catch-all-apply 'vla-load (list (vla-get-Linetypes (vla-get-activedocument (vlax-get-acad-object)) LineTypeName FileName)) ) ) )
    2 points
  2. The program is on my humble website along with the video on YouTube : https://autolispprograms.wordpress.com/fire-fighting-sprinklers-auto-connect-program-1-0-0/
    1 point
  3. Hello @zwonko i make some lisp. Start with "tt" and first time will ask you for precision and Height if you want to change use command "prec" (defun c:tt (/ elev dim grad mspace pt Mtext answ) (defun c:prec () (setq prec (getint "\nSet precison: ")) (setq H (getreal "\nSet text height: ")) ) (if prec (princ) (c:prec)) (if H (princ) (c:prec)) (setq ele (car (entsel "\nSelect first elevation: "))) (if (equal (vlax-get (vlax-ename->vla-object ele)'ObjectName) "AcDbMText") (progn (command "explode" ele) (setq elev (vlax-get (vlax-ename->vla-object (entlast))'TextString )) (command "undo" "1") ) (progn (setq elev (vlax-get (vlax-ename->vla-object ele)'TextString )) ) ) (setq dim (/ (vlax-get (vlax-ename->vla-object (car (entsel "\nSelect dimension: "))) 'Measurement) 100)) (setq grad (/ (atof (vl-string-right-trim "%" (vlax-get (vlax-ename->vla-object (car (entsel "\nSelect grade: "))) 'TextString))) 100)) (setq mspace (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object) ) ) ) (initget "+ -") (setq answ (getkword "\nChose [+/-]<+> ")) (setq pt (getpoint "\nWhere to place the new elevation: ")) (setq mspace (vla-get-modelspace (vla-get-activedocument (vlax-get-acad-object) ) ) ) (setq Mtext (vla-AddMText mspace (vlax-3d-point pt) H (strcat "%<\\AcExpr ((" elev answ (rtos dim 2 prec) "*" (rtos grad 2 prec) ")) \\f \"%lu2%pr" (rtos prec 2 0)"\">%"))) (vlax-put-property (vlax-ename->vla-object (entlast)) 'Height H) (princ) )
    1 point
  4. @hosneyalaa I think you meant for the second option to be. (setq ptSet (ssget '((0 . "INSERT")))) Beautified the code only (remove spaces) Thinking maybe they didn't select everything from the first time. Everything runs fine on Drawing1 they posted. (defun c:TESTADDT (/ ptSet tPt ptLst outLst) (vl-load-com) ;added (if (setq ptSet (ssget "_X" '((0 . "INSERT")))) (progn (setvar "cmdecho" 0) (setq I 0) ; Order of POINT (while (< I (sslength ptSet)) (setq BLK (cdr (assoc 2 (entget (setq Txt_BLK (ssname ptSet I)))))) (setq BLK_INSERTIONPOINT (vlax-get (vlax-ename->vla-object Txt_BLK) 'INSERTIONPOINT)) (setq def (vla-item (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))) BLK)) (setq ptLst (vl-sort (mapcar '(lambda (x) (list (distance (cAr x) BLK_INSERTIONPOINT) (cadr x))) (mapcar '(lambda (x) (list (cdr (assoc 10 x)) (cdr (assoc -1 x)))) (mapcar 'entget (vl-remove-if 'listp (mapcar 'cadr (ssnamex (ssget "X" '((0 . "TEXT") (8 . "2"))))) ) ) ) ) '(lambda (a b) (< (car a) (car b))) ) ) (setq outLst (CAR (cdr (cAr ptLst)))) (setq Text (cdr (assoc 1 (entget outLst)))) (setq Txt_INSERTIONPOINT (vlax-get (vlax-ename->vla-object outLst) 'INSERTIONPOINT)) (setq Txt_Lay (vlax-get (vlax-ename->vla-object outLst) 'layer)) (setq Txt_Height (vlax-get (vlax-ename->vla-object outLst) 'height)) (if (= BLK "Circle_1") (progn (vlax-for obj def (if (wcmatch (vla-get-objectname obj) "AcDbAttribute*") (if (wcmatch (setq tagstr (vla-get-tagstring obj)) "TAG_3") (setq pipenamelist0 (LIST tagstr obj)) ) ) ) (if (= pipenamelist0 NIL) (progn (setq daddattribut (vla-addattribute def Txt_Height acattributemodelockposition "New Attribute" ;;TAG_3 ;;(vlax-3D-point 0 (- (* 1.5 Txt_Height))) (vlax-3D-point (mapcar (function (lambda (a b) (- a b))) Txt_INSERTIONPOINT BLK_INSERTIONPOINT)) "TAG_3" Text ) ) (vla-put-ScaleFactor daddattribut (vlax-get-property (vlax-ename->vla-object outLst) 'ScaleFactor)) (command "_.attsync" "_N" BLK) ) (progn (vla-put-TextString (CAR (CDR pipenamelist0)) (vla-get-TextString (vlax-ename->vla-object outLst))) (vla-put-ScaleFactor (CAR (CDR pipenamelist0)) (vlax-get-property (vlax-ename->vla-object outLst) 'ScaleFactor)) (command "_.attsync" "_N" BLK) ) ) ) ) (if (= BLK "Square_1") (progn (vlax-for obj def (if (wcmatch (vla-get-objectname obj) "AcDbAttribute*") (if (wcmatch (setq tagstr (vla-get-tagstring obj)) "TAG_7") (setq pipenamelist (LIST tagstr obj)) ) ) ) (if (/= pipenamelist NIL) (progn (vla-put-TextString (CAR (CDR pipenamelist)) (vla-get-TextString (vlax-ename->vla-object outLst))) (vla-put-ScaleFactor (CAR (CDR pipenamelist)) (vlax-get-property (vlax-ename->vla-object outLst) 'ScaleFactor)) (command "_.attsync" "_N" BLK) ) (progn (setq daddattribut (vla-addattribute def Txt_Height acattributemodelockposition "New Attribute" ;;TAG_3 ;;(vlax-3D-point 0 (- (* 1.5 Txt_Height))) (vlax-3D-point (mapcar (function (lambda (a b) (- a b))) Txt_INSERTIONPOINT BLK_INSERTIONPOINT)) "TAG_7" Text ) ) (vla-put-ScaleFactor daddattribut (vlax-get-property (vlax-ename->vla-object outLst) 'ScaleFactor)) (command "_.attsync" "_N" BLK) ) ) ) ) (SETQ I (+ 1 I)) ) ) ; end progn ) ; end if (setvar "cmdecho" 1) (princ) ;added ); end of c:npts
    1 point
  5. 1 point
  6. (defun _sums (l / s) (setq s 0) (mapcar '(lambda (x) (setq s (+ s x))) l) ) _$ (_sums '(1 2 3 4)) (1 3 6 10) _$
    1 point
  7. I just watched some of the YouTube video, SWEET! People are going to LOVE that!
    1 point
  8. I'd select the viewports and use Properties Palette to Unlock, change scale, and relock to avoid modifying layer or other properties.
    1 point
  9. My Fire Fighting Grooved and Threaded Auto Connect Sprinklers program 1.4.0 was approved a few minutes ago from Autodesk and you can take a look from the following direct link. https://apps.autodesk.com/ACAD_E/en/Detail/Index?id=134530920785950835&appLang=en&os=Win32_64
    1 point
  10. I know I hate it when viewport is not locked, zoom headaches, a quicky lisp that unlocks changes scale then locks again would be worthwhile, lets wait for DecPD are they locked ? Also metric or imperial scales. ; IAcadPViewport: IAcadPViewport Interface ; Property values: ; Center = (397.414 301.03 0.0) ; CustomScale = 1.69529 ; DisplayLocked = 0 ; Document (RO) = #<VLA-OBJECT IAcadDocument 0000026048b53938> ; Layer = "Vport" ; ModelView = nil ; ObjectName (RO) = "AcDbViewport" is locked ; DisplayLocked = -1
    1 point
  11. Yeah it's one of the commands I use pretty much daily. The mechanics are indeed different between locked and unlocked. But it's a great command for so many different things. If you matchprop with source object a locked viewport it works ok. Just not the other way around (because the VP can't be rescaled if its locked). -ChriS
    1 point
  12. you need to reload PHANTOM line type firstly then run BIGAL code.
    1 point
  13. Thank you mhupp Yes, I forgot (vl-load-com) Dgoutz Add this to the code
    1 point
  14. The issue is that the ssget filter list is quoted as a literal list, and therefore the symbol 'e' will not be evaluated as a variable to yield the value it has been assigned, but will instead remain as a symbol. To better understand this behaviour, and how to alter the expression to evaluate the variable, you may wish to read my tutorial on The Apostrophe and the Quote Function.
    1 point
  15. Hi @rkmcswain and all who have commented - thanks for your kind words. It has been a pleasure to keep this forum in good order over so many years (the CADTutor site is 25 years old this year!). Naturally, a forum isn't anything without its members, so I thank you all, in return, for being such a great community who continue to post brilliant content and .give your time freely to help others. Long may it continue!
    1 point
×
×
  • Create New...