All Activity
- Past hour
-
Overall, Lisp works as expected. I mainly use it to draw simple cable trays. I know that creating things like T-junctions and branches will be impossible, so I'm not even asking for that. Width range we use between 50-500mm most often 100mm and 200mm.
-
Fillet Polylines with no Trim
SLW210 replied to Ahmed Khaled's topic in AutoCAD 2D Drafting, Object Properties & Interface
You should first ask at that thread in your link and let the author of that code amend it. -
Copy blocks to curve according to another curve
SLW210 replied to HypnoS's topic in AutoLISP, Visual LISP & DCL
I'll look into that, I might have posted the wrong one. I was working on one to just use the block clicked assuming a single attribute.- 27 replies
-
- autolisp
- block position
-
(and 3 more)
Tagged with:
- Today
-
It seems non productive to not get a FREE program to do what you need. Maybe I'll have time later today to look at them, I have these LISPs from a while back, though I may have skipped some versions. So just to make any time spent on this worthwhile, what exactly are you looking to do and what, besides the error and select elbow from dropdown, that you mentioned? What standards do you use? What size ranges do you work with? Are you doing pipe, ducts, cable trays, etc.
-
Lee Mac started following acet-laytrans
-
Use double-backslashes.
-
tantbd44 started following Tharwat
-
jim78b started following acet-laytrans
-
hello i have problem loading acet-laytrans from scr file. (acet-laytrans "C:\Users\Utente\Dropbox\Lavoro\backup\AUTOCAD\Template\mauro\MOD.las" [1]) The specified file could not be found.; error: ADS request error why?
-
Weirdly for this one, I didn't check Lee Mac, I usually do. I did look at Taborder, but likely that the title blocks will be updated in the near future, tab order might change so this way was a bit future proofing (fewer later changes). Thanks for LISPs, I'll take a look at them this morning
-
Currently, I have to use pure CAD at work. I can't download the MEP version. We're slowly starting to implement REVIT, but it will take time.
-
Copy blocks to curve according to another curve
HypnoS replied to HypnoS's topic in AutoLISP, Visual LISP & DCL
@devitgYeh! Distance between blocks on a new straight polly. @SLW210Sorry but typing block atribute or even clicling on it seems to no work for me Enter the tag to use: ADRES ; error: bad argument type: numberp: ---- 27 replies
-
- autolisp
- block position
-
(and 3 more)
Tagged with:
- Yesterday
-
Have a look at Lee-mac "page X of Y" does just that for title blocks. You can make a field that uses taborder for sheet number and count for the total of layouts., I would use these in attributes of a title block where I worked it had 25 attributes. Trying to find a shorter version. Had something the COUNT did not work in Bricscad V24. Just a second comment look here for DWGINDEX.lsp does just that makes a index of your layouts based on title block Tag names. InsertSheetofSheets.lsp Dwgindex.lsp
-
Fillet Polylines with no Trim
Ahmed Khaled replied to Ahmed Khaled's topic in AutoCAD 2D Drafting, Object Properties & Interface
in the link below https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/fillet-and-trim-just-one-entity/td-p/8885891 -
Fillet Polylines with no Trim
SLW210 replied to Ahmed Khaled's topic in AutoCAD 2D Drafting, Object Properties & Interface
Please use Code Tags for your code in the future. (<> in the editor toolbar) Where did you find this LISP? -
Fillet Polylines with no Trim
Ahmed Khaled posted a topic in AutoCAD 2D Drafting, Object Properties & Interface
Hi all; I found this lisp below on the internet it works perfectly, but i have multiple lines i need to enter the radius for each line, so i was wondering if anyone can help me to let the lisp take the same fillet as regular fillet without asking each time and the lisp repeat it self untill pressing "ESC", Thanks in advance ; fillet with Radius, First keep, second trim (defun c:FCLL (/ *error* adoc oVAR nVAR getval e1 e2 entq p2 l l1 e er ss 1pt 2pt midpt ename param oblouk LayerName z1) ;******** (defun *error* (errmsg) (if (not (wcmatch errmsg "Function cancelled,quit / exit abort,console break,end")) (princ (strcat "\nError: " errmsg))) (mapcar 'setvar nVAR oVAR) (vla-endundomark adoc) (princ)) ;;; GETVAL - returns the group value of an entity. ;;; like the wellknown (dxf) function but accepts all kinds of ;;; entity representations (ename, entget list, entsel list) (defun GETVAL (grp ele) ;"dxf value" of any ent... (cond ((= (type ele) 'ENAME) ;ENAME (cdr (assoc grp (entget ele))) ) ((not ele) nil) ;empty value ((not (listp ele)) nil) ;invalid ele ((= (type (car ele)) 'ENAME) ;entsel-list (cdr (assoc grp (entget (car ele)))) ) (T (cdr (assoc grp ele)))) ); end getval (vla-startundomark (setq adoc (vla-get-activedocument (vlax-get-acad-object)))) (setq oVAR (mapcar 'getvar (setq nVAR '(CMDECHO TRIMMODE PEDITACCEPT OSMODE)))) (mapcar 'setvar nVAR '(1 0 1 0 )) (setvar "filletrad" (cond ((getreal (strcat "\nSpecify fillet radius <" (rtos (getvar "filletrad") 2 2) ">: "))) (T (getvar "filletrad")))) (while (and (null (setq e1 (entsel "\nSelect first object (TO BE MODIFIED): "))) (wcmatch (getval 0 e1) "LINE,ARC,LWPOLYLINE"))) ;Identify the layer of the first selected entity (setq LayerName (cdr (assoc 8 (entget (car e1))))) (redraw (car e1) 3) (while (and (null (setq e2 (entsel "\nSelect second object (REMAINS THE SAME): "))) (wcmatch (getval 0 e2) "LINE,ARC,LWPOLYLINE"))) (redraw (car e2) 3) (setq p1 (cadr e1)) (setq e1 (car e1)) (if (= (getval 0 e1) "LWPOLYLINE") ;if 1nd polyline (progn (setq l (entlast)) (command "_.EXPLODE" e1) ;make it line or arc (would be trimed) (setq ss (ssadd)) (ssadd (setq e (entnext l)) ss) (while (setq e (entnext e)) (ssadd e ss)))) (if (= (getval 0 e2) "LWPOLYLINE") ;if 2st polyline (progn (setq ename (car e2) midpt (vlax-curve-getClosestPointTo ename (trans (cadr e2) 1 0)) param (vlax-curve-getParamAtPoint ename midpt) 1pt (vlax-curve-getPointAtParam ename (fix param)) 2pt (vlax-curve-getPointAtParam ename (1+ (fix param)))) (if (> (abs (- (- (vlax-curve-getDistAtPoint ename 2pt) (vlax-curve-getDistAtPoint ename 1pt)) (distance 2pt 1pt))) 0.002) (setq oblouk T)) (if oblouk (command "_.ARC" 1pt midpt 2pt) ;make it line or arc (would be keeped) (command "_.LINE" 1pt 2pt "")) (setq l2 (cons (entlast) (list (cadr e2)))))) ;if 1st line or arc (if (wcmatch (getval 0 e2) "LINE,ARC,CIRCLE") (progn (entmake (entget (car e2))) ;duplicat it (setq l2 (cons (entlast) (list (cadr e2)))))) (setvar "trimmode" 1) (command "_.FILLET" (nentselp p1) l2) ;new arc (setq er (entlast)) (command "_.CHANGE" er "" "_P" "_LAyer" LayerName "") ; change layer (entdel (car l2)) ;trim substitude of 1st erased (if ss (command "_.PEDIT" er "_J" ss "" "" ;if 2nd was pl, recreate pl "_.ERASE" ss "")) ;the rest of it (2nd side) erase (command "_.REGEN") (*error* "end") (princ) ) -
Part 2 of my weekend homework, adding more for info. This one searches for blocks, gets the object ID for a named attribute and returns the field expression for that attribute. MyString is a default text if the required attribute isn't found in any blocks (loop stops when it finds the named attribute in a block). Example I was looking at is as my Insert blocks DCL, above, adding in a drawing border made of a few blocks one of them is a field from the drawing number - adding in the title block the object name is dynamic, this gets the code needed for that title block (defun PMField ( MyField MyString / MyBlocks Ent acount Att x tmplist) (setq MyBlocks (ssget "_X" '((0 . "INSERT")))) (setq acount 0) (while (and (equal tmplist nil) (< acount (sslength MyBlocks))) (setq Ent (ssname MyBlocks acount)) (foreach Att (vlax-invoke (vlax-ename->vla-object Ent) 'GetAttributes ) ;_ end of vlax-invoke (if (= (strcase (vla-get-TagString Att)) MyField) (setq tmpList (cons Att (vla-get-TextString Att))) ) ; end if ) ; end foreach (setq acount (+ acount 1)) ) ; end while (if (equal tmplist nil) (progn (princ (strcat "No block with attribute '" MyField "' found")) ;; (setq MyString "OFFICIAL") ) (progn (setq x (car tmplist)) (setq MyString (strcat "%<\\AcObjProp Object(%<\\_ObjId "(itoa (vla-get-objectid x))">%).TextString>%")) ) ; end progn ) ; end if MyString )
-
Coming back to this one again... I came on this solution, weekend testing and it works so far. Just needs the vla-put-textstring to update the text to a field. Not checked yet if it will do a nice mix of text and field - should do. Also noted that can entmake text with a field embedded into a block - doesn't need that extra line, when block is inserted it does its stuff (example, attributes for drawing number and drawing number repeated at the top left corner as a field.. see next comment) (setq MyString -String including field codes- ) (setq MTextObj (vlax-ename->vla-object (entmakex (list '(0 . "MTEXT") '(100 . "AcDbEntity") '(67 . 0) '(8 . "0") '(100 . "AcDbMText") '(10 0.0 0.0 0.0) '(40 . 2.5) '(41 . 0.0) '(46 . 0.0) '(71 . 1) '(72 . 5) (cons 1 MyString) '(7 . "Standard") '(11 1.0 0.0 0.0) '(42 . 15.4246) '(43 . 2.58697) '(50 . 0.0) '(73 . 1) '(44 . 1.0) )) ; end entmakex ; end list )) ; end vlax-ename ; end setq (vla-put-textstring MTextObj MyString) ;; update field.
-
Adding data to property lookup tables
BIGAL replied to jamami's topic in AutoCAD Drawing Management & Output
Slowly getting some where, this looks through the block including nested blocks and finds the visibility state for nested blocks. I have no idea how many are nested in the block. or why I am getting multiple answers in the dcl but they change. So keep picking different answers than default button 1, I got stuff changing. Maybe make the heading the block name. (defun c:BlockEnts_mod ( / :block e att1 att_entlst1) (setq lst '()) (defun :block (e l) (setq l (1+ l)) (while (setq e (entnext e)) (princ (strcat "\n" (itoa l) ":")) (if (not (member (cdr (assoc 0 (entget e))) (list "ATTDEF" "SEQEND"))) (princ (cdr (assoc 0 (entget e)))) ) (if (= "INSERT" (cdr (assoc 0 (entget e)))) (setq lst (cons e lst)) );if );while );defun (if (setq e (car (entsel "Select block: "))) (progn (if (assoc 66 (entget e)) (progn (setq att1 (entnext e) att_entlst1 (entget att1) ) (while (= "ATTRIB" (cdr (assoc 0 att_entlst1))) (princ (strcat "\n1:" (cdr (assoc 0 att_entlst1)) )) (setq att1 (entnext att1) ) (if att1 (setq att_entlst1 (entget att1) )) );while );progn );if (princ "\n------") (:block (tblobjname "BLOCK" (cdr (assoc 2 (entget e)))) 0) );progn );if (princ) );defun (c:BlockEnts_mod) (defun insdyne (e / pt obj lst ans) (if (not LM:setdynpropvalue )(load "Lee-mac Dynamic block get-put")) (if (not AH:Butts)(load "Multi Radio buttons.lsp")) (setq obj (vlax-ename->vla-object e)) (setq visval (LM:getvisibilityparametername obj)) (if (= visval nil) (princ) (progn (setq lst (LM:getdynpropallowedvalues obj visval)) (setq lst (cons "Please choose" lst)) (if (not AH:Butts)(load "Multi Radio buttons.lsp")) (if (not AHbut)(setq AHbut 1)) (setq ans (ah:butts 1 "v" lst)) ) ) (LM:SetVisibilityState obj ans) (princ) ) (defun dynnn ( / ) (foreach ent lst (insdyne ent) ) (dynnn) The more I look at this the more I believe to do it as parts as the blocks make up an object you can set each part visibility way easier than making like 900 visibility states. A big advantage is can make a table of the quantities involved per structure or even per dwg. Counting common objects etc. -
DATVO started following Create Multileader with default text using lisp
-
Create Multileader with default text using lisp
DATVO replied to joemcanciller's topic in AutoLISP, Visual LISP & DCL
For more tools related to MLeader, you can consider using this one: https://lispautocad.gumroad.com/l/eezilo -
There is vlr-object-reactor, which can call a defun like your lisp. i dont know how though you would pass it the correct block object to change. If you make the text a block then you could have a invisible attribute which is the handle ID of the matching block. https://www.google.com/search?q=reactor+object+cahnged+autocad+lisp&sca_esv=3b7e4dc23e2c7901&source=hp&ei=KKWOaOmOLsaU4-EPgIS0-Qk&iflsig=AOw8s4IAAAAAaI6zOGqTE_bufe0aJLcdS0xRbMY74k-X&ved=0ahUKEwjpwoS9qe2OAxVGyjgGHQACLZ8Q4dUDCA8&uact=5&oq=reactor+object+cahnged+autocad+lisp&gs_lp=Egdnd3Mtd2l6IiNyZWFjdG9yIG9iamVjdCBjYWhuZ2VkIGF1dG9jYWQgbGlzcDIHECEYoAEYCjIFECEYnwVI4lFQgwpY-ExwAXgAkAEAmAGWAqAB1TWqAQcwLjE4LjE3uAEDyAEA-AEBmAIkoALFNqgCCsICChAAGAMY6gIYjwHCAgsQABiABBixAxiDAcICCxAuGIAEGLEDGIMBwgIREC4YgAQYsQMY0QMYgwEYxwHCAg4QLhiABBixAxiDARiKBcICDhAAGIAEGLEDGIMBGIoFwgIIEAAYgAQYsQPCAg4QLhiABBixAxjRAxjHAcICCxAuGIAEGNEDGMcBwgIOEAAYgAQYsQMYgwEYyQPCAg4QABiABBixAxiSAxiDAcICCxAAGIAEGJIDGIoFwgIUEC4YgAQYsQMYgwEYxwEYjgUYrwHCAggQLhiABBixA8ICDhAuGIAEGMcBGI4FGK8BwgIFEAAYgATCAgUQLhiABMICBhAAGBYYHsICCBAAGBYYChgewgILEAAYgAQYhgMYigXCAgUQABjvBcICCBAAGIAEGKIEwgIIEAAYogQYiQXCAgUQIRigAcICBhAhGBUYCpgDBvEFDVTDEYK0XNeSBwcxLjE4LjE3oAfdwwGyBwcwLjE4LjE3uAe-NsIHBzExLjE3LjjIB04&sclient=gws-wiz You could do a lisp that saves the two objects handles and use the reactor on close, save & quit to update via lisp the objects. I have used save etc to do something. I use ldata to save values in a dwg so you would have one data value which is how many, then you would have multiple values saved. The other method is to use Xdata on say the text saving the block ID. Again the handle. Doing the text on specific layers may make it fast to check v's getting all text in the dwg.
- Last week
-
Hi @Steven P and all to friends, With help of AutoCAD forum I got solution upto 95%. https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/custom-pc3-not-supported/m-p/13750967#M165599 Remaining 5% issue were posted. Could you guys help with this?. Thanks in advance
-
DATVO changed their profile photo
-
Convert leaders to multileaders by picking in pairs, add more content, and assign custom layers — all in one smart tool. Save time and stay organized: https://lispautocad.gumroad.com/l/eezilo
-
If you're tired of dealing with countless hard-to-manage leaders, or want to add more content, try this tool — it will help you save a lot of time: https://lispautocad.gumroad.com/l/eezilo
-
Well I feel quite stupid now Since reading and writing to a file using those funcions for working with binary files by Lee worked, I thought that it must be a binary file, but I guess that whenever I'm reading from a file a writing the result back to it, the behaviour will be the same since those are working in a same opposite way, as long as reading and writing are both done as binary, ansi or something else. Anyway thanks for help, I'm not in the office now for few days, but I'll test it when I get back. But I think that's it, big thanks.
-
Adding data to property lookup tables
jamami replied to jamami's topic in AutoCAD Drawing Management & Output
the app shown in the video looks superb, we really need something like this.....however despite significant cad experience have very little programming knowledge outside of VB. Chat GPT suggested the only way to add data to the lookup table was using a C# programme as lisp was unable to do it? using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.EditorInput; using Autodesk.AutoCAD.Runtime; using System; using System.Collections.Generic; using System.IO; using System.Linq; [assembly: CommandClass(typeof(AutoCAD_CSVImport.MyCommands))] namespace AutoCAD_CSVImport { public class MyCommands { [CommandMethod("ImportLookupTable")] public void ImportLookupTable() { // File path to your CSV string filePath = @"C:\path_to_your_file.csv"; // Check if the file exists if (!File.Exists(filePath)) { Application.ShowAlertDialog("File not found: " + filePath); return; } // Read CSV file List<string[]> data = ReadCSV(filePath); // If there is data if (data.Count > 0) { Document doc = Application.DocumentManager.MdiActiveDocument; Database db = doc.Database; Transaction tr = db.TransactionManager.StartTransaction(); try { // Open the Block Table for writing BlockTable blockTable = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForRead); BlockTableRecord blockTableRecord = (BlockTableRecord)tr.GetObject(blockTable[BlockTableRecord.ModelSpace], OpenMode.ForWrite); // Loop through the CSV data foreach (var line in data) { string code = line[0]; string field1 = line[1]; string field2 = line[2]; string field3 = line[3]; string field4 = line[4]; string field5 = line[5]; // Insert or update data into a Dynamic Block or a Lookup Table // (Assuming you already have a dynamic block setup) // This is where you would link to your Lookup Table or Dynamic Block // For now, we're just printing out the data Application.ShowAlertDialog($"Adding: {code}, {field1}, {field2}, {field3}, {field4}, {field5}"); } // Commit the transaction tr.Commit(); } catch (Exception ex) { Application.ShowAlertDialog("Error: " + ex.Message); } finally { tr.Dispose(); } } } // Helper method to read CSV private List<string[]> ReadCSV(string path) { var data = new List<string[]>(); try { using (var reader = new StreamReader(path)) { while (!reader.EndOfStream) { string line = reader.ReadLine(); string[] values = line.Split(','); // Add the data to list (excluding empty lines) if (values.Length > 0) { data.Add(values); } } } } catch (Exception ex) { Application.ShowAlertDialog("Error reading file: " + ex.Message); } return data; } } } i have attached the original block that i am trying to update with alternative ends using multiple vis states. There is a pattern in the viz states after 12m s shown below. Adding 3 options for the ends creates 9 x the number of existing visibility states. A DCL is definitely the way to go as I imagine we could use this to produce the plans and elevations (also similar dynamic blocks) simultaneously. I have a concern that block distribution/sharing would be more complex if using an in-house dcl. jam3.dwg -
Adding data to property lookup tables
jamami replied to jamami's topic in AutoCAD Drawing Management & Output
programme for multiple vis sates is called visibility-add-eng_1_6.lsp looks very (very) useful.. multiple visibility states and examples -
harimaddddy started following Text content sync
-
Hi all, I'm try to build a lisp program to link content of a text and attributes/text. Somehow I manage to place the values in side the attribute with example code references. When comes to introduce a reactor to maintain the sync between the contents I can't. Thus, this text sync can be done with Field but If someone delete the source then its mess. So I came up with this idea. text has the format like SEC_NO,TAG_NO,FLAG_NO. Those would link with same tag named attribute and the copy of blocks as well. Once master text value change the respective values in attribute would change (See snap). if it turns hard, text to text would save tons of time and can use with multiple times. Thanks in advance. trail.lsp TextSync.dwg