All Activity
- Past hour
-
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
- Today
-
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
-
Adding data to property lookup tables
jamami replied to jamami's topic in AutoCAD Drawing Management & Output
the dcl seems to show the same thing as the visibility drop down box ? is the only difference multiple radio buttons. Vs a list box ? -
Adding data to property lookup tables
BIGAL replied to jamami's topic in AutoCAD Drawing Management & Output
have another look at the video, it starts with overall sizes, then gets deeper asking for edge type, the next step is how many window panes hor & ver then the size of the panes. So in your case I exploded the sample block and started to get into the other dynamic blocks, there is no problems inserting a dynamic block then popping up the visibility choices to what you want it set to. I am happy to help. so have a think about an approach first step would be the top row matching visibility lengths. Next step would be the left and right edges type may be different. then central columns. Here is some code if you explode your block so now have separate dynamic blocks, just pick one and a dcl will be made displaying the visibility options. Ok save the Multi radio buttons and Dynamic block get put lee mac to a support path as they are autoloaded. Save this code and appload it etc (defun insdyne ( / 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 (car (entsel "\nPick a dynamic block ")))) (setq visval (LM:getvisibilityparametername obj)) (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) ) (insdyne) So pick the truss displayed, the visibility for that block are displayed and you choose. Dynamic block get-put Lee-mac.lspMulti radio buttons.lsp -
Import Drawing Properties from Excel using AutoLISP
DATVO replied to Rayan Lobo's topic in AutoLISP, Visual LISP & DCL
You can refer to this tool — I find it handles large file volumes well and even provides a report file. https://lispautocad.gumroad.com/l/rnyiew -
Import Drawing Properties from Excel using AutoLISP
DATVO replied to Rayan Lobo's topic in AutoLISP, Visual LISP & DCL
You can refer to this tool — I find it handles large file volumes well and even provides a report file. https://lispautocad.gumroad.com/l/rnyiew -
Adding data to property lookup tables
jamami replied to jamami's topic in AutoCAD Drawing Management & Output
The block jam1 works well for 2.3 and 14m and provides the flexibility to change length, lhs end type and rhs end type. it is a shame that acad do not provide inherent multiple visibility parametrs as the workaround is quite clunky and labour intensive .it is also unfortunate that data cannot be pasted or scripted into lookup tables. the workaround doesn’t work with block property table. I have seen a website that provides an addin to allow multiple visibility parameters and have looked at a block created with this that works well. Did you say Lee Mack also has a routine to do this ? Because there are several other permutations I need to include I Ithink you are correct regarding the use of multiple dynamics blocks, this requires a few more clicks to use but will ultimately save a lot of time having not to explode the block and adjust the contents . . the data generation in Excel is simple , putting the data into lookup tables is where I am struggling as it requires manually entering 1500 items of data into separate cells . So much easier with block properties table where it is one operation using simple cut paste . This is why I am now preparing multiple dynamic blocks and splitting out the various structural element types . Thank you for your help with this I will spend some time and try to understand the lisp provided . -
closed polyline with automatic hatch
CivilTechSource replied to james9710's topic in AutoLISP, Visual LISP & DCL
So I saw this post and came up with the idea to create a lisp to draw polyline once closed it will insert the area of the polyline at the centre (this is for drainage catchment). Did I overcomplicate the lisp? Initially I was going for static text, but I am all about making life easier so tried to merge the ATC function from the lisp here https://jtbworld.com/autocad-areatext-lsp . Any feedback on the below lisp would be appreciated. Thank you all! (setq jtbfieldformula ">%).Area \\f \"%lu2%pr1%ps[,m²]%ct8[0.001]\">%") (defun Get-ObjectIDx64 (obj / util) (setq util (vla-get-Utility (vla-get-activedocument (vlax-get-acad-object)) ) ) (if (= (type obj) 'ENAME) (setq obj (vlax-ename->vla-object obj)) ) (if (= (type obj) 'VLA-OBJECT) (if (> (vl-string-search "x64" (getvar "platform")) 0) (vlax-invoke-method util "GetObjectIdString" obj :vlax-False ) (rtos (vla-get-objectid obj) 2 0) ) ) ) (defun c:CTS-DrawGullyCatchment () (if (not (tblsearch "LAYER" "CTS-Gully Catchment")) (command "-LAYER" "_M" "CTS-Gully Catchment" ;;Set Layer Name "_C" "True" "0,255,0" ;;Set Color "CTS-Gully Catchment" ;;Set Layer Name "") ) (command "._pline") (while (and (not (initget 32)) (if pt (setq pt (getpoint pt)) (setq pt (getpoint)) ) ) (command pt) ) (command "_c") (if (and (setq e (entlast)) ; 'e' now holds the entity name of the polyline (setq el (entget e)) (= (cdr (assoc 0 el)) "LWPOLYLINE") (= (logand (cdr (assoc 70 el)) 1) 1) ) (progn (command "._area" "_o" e) ;;(setq GullyArea (getvar "area")) ; Get the area of the polyline ;;(setq GullyAreaTxt (strcat (rtos GullyArea 2 2) "m2")) ;;(setq GullyAreaTxtPt (getpoint "\nSpecify point for Guylly Cathcment text:")) (vl-load-com) (setq entObject (vlax-ename->vla-object (setq ent (entlast)))) (setq entObjectID (Get-ObjectIDx64 entObject)) (setq lastpt (getvar "lastpoint")) (setq InsertionPoint (vlax-3D-Point(trans (osnap lastpt "_gcen") 1 0))) (setq ad (vla-get-ActiveDocument (vlax-get-acad-object))) (setq mtextobj (vla-addMText (if (= 1 (vla-get-activespace ad)) (vla-get-modelspace ad) (if (= (vla-get-mspace ad) :vlax-true) (vla-get-modelspace ad) (vla-get-paperspace ad) ) ) InsertionPoint 0.0 (strcat "%<\\AcObjProp Object(%<\\_ObjId " entObjectID jtbfieldformula ) ) ) (vla-put-AttachmentPoint mtextobj 5) (vla-put-insertionPoint mtextobj InsertionPoint) ) ) ) -
Adding data to property lookup tables
BIGAL replied to jamami's topic in AutoCAD Drawing Management & Output
As I said previously I believe would be much easier to just enter length and end types. Draw correct shape or use multiple dynamic blocks rather than trying to put it all into one block. I exploded your block with different lengths and start to see patterns. There is another post at the moment that has asked about changing nested dynamic blocks changing each block individually. I am looking at that. Using a DCL for input of data may be the way to go hence the movie showing input data which includes right and left edges. One thing I noticed is that if you say 5m length it makes a 3m+2m lengths structure, so that leads me on to the next step, I can make a Excel say 2-50 using the code I provided it will make the "howmany" 6x 5x 4x 3x 2x etc you can then change so a 8 will become 2x4m (0 0 2 0 0) or a 5+3m (0 1 0 1 0) your choice then can read the Excel for matching lengths, then ask about end types. Or put the sizes into the lisp code. - Yesterday
-
-
The file is not a binary file, it is just a plain text file using UTF-16 big endian encoding (most text files are ANSI). To read/write it, you cannot use open/read-line/write-line on AutoCAD, as these do not support Unicode double-byte encoding. Instead, you can use the ADO Stream object - here are some existing examples from VovKa: https://www.theswamp.org/index.php?topic=39617.0
-
Copy blocks to curve according to another curve
SLW210 replied to HypnoS's topic in AutoLISP, Visual LISP & DCL
The actual TAG name, in the drawing you posted it is ADRES- 26 replies
-
- autolisp
- block position
-
(and 3 more)
Tagged with:
-
gilsoto13 started following Deleting Hatch from Blocks
-
you da man
-
Copy blocks to curve according to another curve
devitg replied to HypnoS's topic in AutoLISP, Visual LISP & DCL
- 26 replies
-
- autolisp
- block position
-
(and 3 more)
Tagged with:
-
Some of you may already be familiar with CADCAL, which brings the full functionality of Autodesk's GeomCAL to BricsCAD. Now there's a new program with significantly expanded functionality. As before, it's available free of charge; download from https://www.calscript.com/home.html What's new? 1. CADCAL has been enhanced with several new features, most notably, the input of cylindrical coordinates is now possible. An overview of the functions that can be called with the CAL command can be found here: https://www.calscript.com/cal-ddcal.html#listofcal 2. There's a new DDCAL command, which is controlled via a dialog box. The main advantage is that you no longer have to memorize the many CAL functions or laboriously search for them in the documentation; instead, you can select them directly from a list box in the dialog. A description is also displayed for each function selected in the list box. CAL expressions entered and evaluated using the DDCAL command are saved as a history in the DWG. The history is displayed in the DDCAL dialog, and you can always access these CAL expressions and their results (!) later. Even after closing the CAD session and reopening the DWG, even on other computers. You can find the description of DDCAL here: https://www.calscript.com/cal-ddcal.html#ddcal 3. CALScript offers something completely new. This program was developed based on the observation that users use CAD scripts in which mathematical expressions are calculated using CADCAL/GeomCAL and used to generate parametrically defined drawing parts. CALScript can be used as a variant design program, with more options than dynamic blocks. Absolutely no programming is required; the variant definitions are simply created via scripts. These scripts look exactly like conventional CAD scripts, but you can also enter user input within them. CALScript executes such a script by translating the script into Lisp. This translation function is also available to the user, providing them with a ready-made Lisp function that they can also integrate into their own applications. And because you can call Lisp functions in scripts, you can also make your existing Lisp functions "smart" simply by embedding the function in a CALScript script. The CALScript objects can be edited later, and they can even communicate with each other to model/simulate any system. For a first introduction to CALScript: https://www.calscript.com/calscript-quickstart.html The web pages are still under construction and will be updated. But together with the many demo scripts that come with the installation, you can already get a good impression of the possibilities. Let me know what you think!
-
Copy blocks to curve according to another curve
HypnoS replied to HypnoS's topic in AutoLISP, Visual LISP & DCL
@SLW210 I tried yours but I cant get it to work, I think Im missing something. "Enter the tag to use" What tag am I supposed to type in? Attribute name or value does not work.- 26 replies
-
- autolisp
- block position
-
(and 3 more)
Tagged with:
-
Why not use the specialized toolset MEP? Since it's FREE, I doubt if anyone is very interested in continuing to update/repair the WPIPE LISPs.
-
Copy blocks to curve according to another curve
SLW210 replied to HypnoS's topic in AutoLISP, Visual LISP & DCL
Did you bother to try my code? It asks for a line and distance between blocks.- 26 replies
-
- autolisp
- block position
-
(and 3 more)
Tagged with:
-
Copy blocks to curve according to another curve
HypnoS replied to HypnoS's topic in AutoLISP, Visual LISP & DCL
TBH devito code meets my needs, for what i send big thanks once more. One thing I'd like to be added is to let me change distance between blocks- 26 replies
-
- autolisp
- block position
-
(and 3 more)
Tagged with:
-
I'd like to report a small bug with WPIPE[12] that's does not occur in WPIPE[11]. After choosing all settings user can't change pipe width before drawing like in WPIPE[11]. Typing new width just places first point of pipe.
-
So when I open the file it's readable but when I try to write to it using write-line command the characters are displayed in a file as some unknown symbols, so I can't claim for sure that it's a binary file but it's only reason that comes to my mind that can cause such behavior, in addition those functions for reading and writing binary by Lee worked on a file flawless in combo. But yeah, I can't tell for sure it's a binary file, but it's my assumption. Sure, provided below. Thanks for info, I know that because I have Acad at home so I looked into it but on work I searched through whole ZWCAD registry and there's nothing in there, but on the other side I didn't found AppAutoLoad.app file anywhere among Acad files, so I guess ZWCAD put it in a file instead of registry (not sure why but that's how it is). AppAutoLoad.app