All Activity
- Past hour
-
How can I make the following program support Chinese input?
SLW210 replied to xcn's topic in AutoCAD 2D Drafting, Object Properties & Interface
I was just suggesting a rewrite, though I think maybe it is a Unicode issue so it might be altered. That's what I came back with on an internet search for change AutoCAD LISP from English input to Chinese and the articles I read claimed Chinese has double-byte Unicode, the GREAD LISPSYS=2 is necessary. Is this on a Chinese Simplified version of AutoCAD, Windows , etc.? Give some more detailed information on the setups this will be used. I just started studying Chinese a few weeks ago, so I want be a ton of help on that end and haven't got into the characters yet. - Today
-
From coordinate hallucination to 7-token precision (LISP Sandbox)
VicoWang replied to VicoWang's topic in AutoLISP, Visual LISP & DCL
Just a quick update on this experiment: An AEC startup working on automated 2D quantity takeoff reached out to me today. They’ve been using AI to extract drawing data, but have been hitting a wall with geometric precision, and wanted to see if the v-code RPN approach could work for their 2D pipeline. When I started experimenting with v-code, the whole point was to slash token bloat and eliminate coordinate hallucinations through a deterministic stack machine (the 3D CSG solid in the sandbox was just a visual way to demonstrate the stack collapsing into geometry). Seeing a team take that core concept and explore applying it to real-world 2D data extraction has been an unexpected and very encouraging surprise. -
VedaCAD - Technical Support, Updates & Community VCIDs
VicoWang replied to VicoWang's topic in AutoLISP, Visual LISP & DCL
Welcome to join the VedaCAD WhatsApp group: https://chat.whatsapp.com/BsM62YEol9SHdKoWxaeW1D -
NTH joined the community
-
How can I make the following program support Chinese input?
xcn replied to xcn's topic in AutoCAD 2D Drafting, Object Properties & Interface
@BIGAL The goal isn’t just to change color. This AutoLISP routine is an interactive character-level editor for a single-line TEXT entity. It lets you: 1. Select an existing TEXT object. 2. Move the mouse along the text to highlight a range of characters. 3. Type replacement characters. 4. Press Enter or Space to replace the highlighted range in the original text. The temporary red text created by ht:paint is only a visual highlight of the selected character range. It is not meant to permanently change color. -
How can I make the following program support Chinese input?
BIGAL replied to xcn's topic in AutoCAD 2D Drafting, Object Properties & Interface
Not sure what your trying to achieve. Could you describe more. If it's about changing color then just use mtext. - Yesterday
-
multiple file selection dialog box using lisp & powershell
Paul Li posted a topic in AutoLISP, Visual LISP & DCL
Attached is an improved version of getfiled that implements powershell with the option to select single or multiple files returning a list of the selected item(s): Examples: (pl:getfiledps "Select Files" (getvar"dwgprefix") "dwg" 0) ; for single selection of file type dwg (pl:getfiledps "Select Files" (strcat (getenv "userprofile") "\\downloads") "dwg;dxf" 1) ; for multiple selection of file types dwg & dxf Feedback & comments are welcome. pl_getfiledps.lsp-
- 2
-
-
ynywii joined the community
-
Danielm103 started following xdrx
-
if you're running Civil 3D 2019, then xdrx.x64.25.arx is not the correct version, it would be xdrx.x64.23.arx
-
How can I make the following program support Chinese input?
xcn replied to xcn's topic in AutoCAD 2D Drafting, Object Properties & Interface
I came up with it. If it could be completely rewritten, that would be great. -
I haven't seen the person that was posting here promoting that in a while, but you might try messaging them here or their website. @XDSoft
-
Do you really need a separate DWG for every revision?
SLW210 replied to indiancad's topic in AutoCAD Drawing Management & Output
I forgot to mention, for keeping up with the revisions we have Excel drawing lists with the Drawing names, dates and latest revision number on the network. P&IDs keep a dated track of each and every revision in cast things get put back to an older revision. -
How can I make the following program support Chinese input?
SLW210 replied to xcn's topic in AutoCAD 2D Drafting, Object Properties & Interface
From where did that LISP originate? Mandarin? Glancing through that LISP a little, I am almost positive the best way would be to completely write something new. -
Well done, nice use of Parallel.For! Kdtree’s are definitely a must have in the CAD programmer’s tool box.
-
@Danielm103 Well I did managed to scrape some milliseconds. However not where it counts in the pairing. Most of the gain in collection of entities. So in the end it is still gile's code. ymg Command: PAIRKD --------- TIMING ------------------------------- Collecting entities: 236 milliseconds Building kdTree: 67 milliseconds Pairing lines and texts: 34 milliseconds Coloring lines and texts: 123 milliseconds Total Elapsed Time: 460 milliseconds Total Number of Groups: 102 using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Threading.Tasks; using Gile.AutoCAD.R20.Geometry; using Autodesk.AutoCAD.EditorInput; using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.Geometry; using Autodesk.AutoCAD.Runtime; using AcAp = Autodesk.AutoCAD.ApplicationServices.Core.Application; [assembly: CommandClass(typeof(PairLinesWithTextsR17.Commands))] namespace PairLinesWithTextsR17 { public class Commands { private struct EntityPosition { public Entity Entity { get; } public Point3d Position { get; } public EntityPosition(Entity entity, Point3d position) { Entity = entity; Position = position; } } [CommandMethod("PAIRKD")] public void ParallelPairTextsWithLines3() { // Force GC collection prior to timing to avoid GC halts during execution GC.Collect(); GC.WaitForPendingFinalizers(); Stopwatch stopwatch = Stopwatch.StartNew(); Document doc = AcAp.DocumentManager.MdiActiveDocument; Database db = doc.Database; Editor ed = doc.Editor; RXClass lineClass = RXObject.GetClass(typeof(Line)); RXClass textClass = RXObject.GetClass(typeof(DBText)); // Pre-allocate generous capacity to prevent memory reallocations List<EntityPosition> midLines = new List<EntityPosition>(16384); List<EntityPosition> textList = new List<EntityPosition>(16384); using (doc.LockDocument()) using (Transaction tr = db.TransactionManager.StartOpenCloseTransaction()) { LayerTable lt = (LayerTable)tr.GetObject(db.LayerTableId, OpenMode.ForRead); ObjectId lineLayerId = lt.Has("1") ? lt["1"] : ObjectId.Null; ObjectId textLayerId = lt.Has("4") ? lt["4"] : ObjectId.Null; BlockTableRecord modelSpace = (BlockTableRecord)tr.GetObject( SymbolUtilityServices.GetBlockModelSpaceId(db), OpenMode.ForRead); // 1. Fast Collection Phase foreach (ObjectId id in modelSpace) { RXClass rxClass = id.ObjectClass; if (rxClass == lineClass) { Line line = (Line)tr.GetObject(id, OpenMode.ForRead); if (line.LayerId == lineLayerId) { Point3d midPoint = new Point3d( (line.StartPoint.X + line.EndPoint.X) * 0.5, (line.StartPoint.Y + line.EndPoint.Y) * 0.5, (line.StartPoint.Z + line.EndPoint.Z) * 0.5 ); midLines.Add(new EntityPosition(line, midPoint)); } } else if (rxClass == textClass) { DBText text = (DBText)tr.GetObject(id, OpenMode.ForRead); if (text.LayerId == textLayerId) { Point3d pos = (text.Justify == AttachmentPoint.BaseLeft) ? text.Position : text.AlignmentPoint; textList.Add(new EntityPosition(text, pos)); } } } EntityPosition[][] textGroups = textList .GroupBy(t => ((DBText)t.Entity).TextString) .Select(g => g.ToArray()) .ToArray(); long t1 = stopwatch.ElapsedMilliseconds; // 2. KdTree Construction KdTree<EntityPosition> lineTree = new KdTree<EntityPosition>(midLines, ml => ml.Position, 2); long t2 = stopwatch.ElapsedMilliseconds; // 3. Parallel pairing (Math + Spatial Search) int numGroups = textGroups.Length; HashSet<Entity>[] uniqueGroupEntities = new HashSet<Entity>[numGroups]; Parallel.For(0, numGroups, i => { EntityPosition[] group = textGroups[i]; HashSet<Entity> uniqueSet = new HashSet<Entity>(group.Length * 2); for (int j = 0; j < group.Length; j++) { EntityPosition textItem = group[j]; uniqueSet.Add(textItem.Entity); Entity nearestLine = lineTree.GetNearestNeighbour(textItem.Position).Entity; uniqueSet.Add(nearestLine); } uniqueGroupEntities[i] = uniqueSet; }); long t3 = stopwatch.ElapsedMilliseconds; // 4. Sequential Database Modification Phase for (int i = 0; i < numGroups; i++) { int colorIndex = (i % 255) + 1; HashSet<Entity> uniqueSet = uniqueGroupEntities[i]; foreach (Entity entity in uniqueSet) { if (entity.ColorIndex != colorIndex) { if (!entity.IsWriteEnabled) { entity.UpgradeOpen(); } entity.ColorIndex = colorIndex; } } } long t4 = stopwatch.ElapsedMilliseconds; stopwatch.Stop(); ed.WriteMessage($"\n--------- TIMING -------------------------------"); ed.WriteMessage($"\nCollecting entities: {t1} milliseconds"); ed.WriteMessage($"\nBuilding kdTree: {t2 - t1} milliseconds"); ed.WriteMessage($"\nPairing lines and texts: {t3 - t2} milliseconds"); ed.WriteMessage($"\nColoring lines and texts: {t4 - t3} milliseconds\n"); ed.WriteMessage($"\nTotal Elapsed Time: {t4} milliseconds"); ed.WriteMessage($"\nTotal Number of Groups: {numGroups}"); tr.Commit(); } } } } pairkd.dll
-
How can I make the following program support Chinese input?
xcn replied to xcn's topic in AutoCAD 2D Drafting, Object Properties & Interface
Thanks @SLW210 for editing. I couldn't figure out how to format the code, but now I know how! - Last week
-
could you share your dwg?
-
Steven P started following Do you really need a separate DWG for every revision?
-
Do you really need a separate DWG for every revision?
Steven P replied to indiancad's topic in AutoCAD Drawing Management & Output
Likewise, we save a full copy of the as issued drawings, plus the PDF mark ups and check prints each in a separate folder. Unless specified otherwise all our files are suffixed with the revision code. Mark ups and check prints are in sequentially numbered and dated folders - so we can always go back. Typical folders: 1.0 Working Drawings 2.0 Check Prints - 2.1 Check Print 01-01-26 - 2.2 Check Print 15-03-26 3.0 Markups - 3.1 Markup 01-01-26 - 3.2 Markup 10 -03-26 4.0 Previous Versions And of course if there is a significant change between issues, I'll save the before and after away somewhere safe We usually issue PDFs during the project and if required the as-builts as dwgs right at the end I believe that the construction cloud saves each save as a new version whether it is a new revision or not -
How can I make the following program support Chinese input?
SLW210 replied to xcn's topic in AutoCAD 2D Drafting, Object Properties & Interface
Please use code tags in the future. (<> in the text editor) and please post the code formatted. -
Answer from another forum which is a bit more than my answer above - the errors are a kind of firewall to stop the Al bots scraping the websites, taking all the bandwidth, slowing things for the humans - something we'll have to live with for a while I think
-
usually after I click Try Again then it'll work..not sure why..
-
Perhaps you should contact the 3rd party vendor where you install this program from to get the file?
-
@Danielm103, I did build gile's code to autocad 2017 and ran it testmore.dwg Results for PLWT_KDTREE: --------- TIMING------------------------------- Collecting entities: 315 milliseconds Building kdTree: 69 milliseconds Pairing lines and texts: 28 milliseconds Coloring lines and texts: 121 milliseconds Total Elapsed Time: 533 milliseconds Total Number of Colors: 102 colors With that kind of results, I don't see what I could improve on here. I am attaching the cs file converted for acad 2017 and Gile.AutoCAD.R20.Geometry ymg pairs.cs
-
granat started following xdrx
-
c:\program files (x86)\xdsoft\sys\xdrx.x64.25.arx cannot find a procedure that it needs.
-
(defun ht:chars (s / l i n c a) (setq l '() i 1 n (strlen s) ) (while (<= i n) (setq c (substr s i 1) a (ascii c) ) (if (and a (> a 127) (< i n)) (setq l (cons (substr s i 2) l) i (+ i 2) ) (setq l (cons c l) i (1+ i) ) ) ) (reverse l) ) (defun ht:bbox (s hgt wf sty obl / e tb fallback) (setq fallback (list (list 0.0 0.0 0.0) (list 0.0 0.0 0.0))) (if (or (null s) (= s "")) fallback (progn (setq e (entmakex (append (list '(0 . "TEXT") '(100 . "AcDbEntity") '(100 . "AcDbText") '(10 0.0 0.0 0.0) (cons 40 hgt) (cons 1 s) (cons 41 wf) (cons 7 sty) '(72 . 0) '(73 . 0) ) (if obl (list (cons 51 obl)) nil ) (list (cons 11 '(0.0 0.0 0.0))) ) ) ) (if e (progn (setq tb (textbox (entget e))) (entdel e) (if (and tb (listp tb) (listp (car tb)) (listp (cadr tb))) tb fallback ) ) fallback ) ) ) ) (defun ht:wid (s hgt wf sty obl) (car (cadr (ht:bbox s hgt wf sty obl))) ) (defun ht:layout (chars hgt wf sty obl / prefix out result n i x0 x1 totalw) (setq prefix "" out '() ) (foreach ch chars (setq out (cons (list ch (- (ht:wid (strcat prefix ch) hgt wf sty obl) (ht:wid ch hgt wf sty obl) ) ) out ) ) (setq prefix (strcat prefix ch)) ) (setq out (reverse out) totalw (ht:wid prefix hgt wf sty obl) n (length out) i 0 result '() ) (while (< i n) (setq x0 (cadr (nth i out)) x1 (if (< i (1- n)) (cadr (nth (1+ i) out)) totalw ) ) (setq result (cons (list (car (nth i out)) x0 x1) result)) (setq i (1+ i)) ) (reverse result) ) (defun ht:origin (ed / g72 g73 rot x y cx cy tb mnx mxx mny mxy hgt) (setq g72 (cond ((cdr (assoc 72 ed))) (t 0) ) g73 (cond ((cdr (assoc 73 ed))) (t 0) ) rot (cond ((cdr (assoc 50 ed))) (t 0.0) ) hgt (cdr (assoc 40 ed)) ) (if (and (= g72 0) (= g73 0)) (setq x (car (cdr (assoc 10 ed))) y (cadr (cdr (assoc 10 ed))) ) (setq x (car (cdr (assoc 11 ed))) y (cadr (cdr (assoc 11 ed))) ) ) (setq tb (ht:bbox (cdr (assoc 1 ed)) hgt (cdr (assoc 41 ed)) (cdr (assoc 7 ed)) (cdr (assoc 51 ed)) ) mnx (car (car tb)) mxx (car (cadr tb)) mny (cadr (car tb)) mxy (cadr (cadr tb)) ) (setq cx (cond ((= g72 1) (/ (+ mnx mxx) 2.0)) ((= g72 2) mxx) ((= g72 3) 0.0) ((= g72 4) (/ (+ mnx mxx) 2.0)) ((= g72 5) mnx) (t mnx) ) cy (cond ((= g73 1) mny) ((= g73 2) (/ hgt 2.0)) ((= g73 3) hgt) (t 0.0) ) ) (list (- x (- (* cx (cos rot)) (* cy (sin rot)))) (- y (+ (* cx (sin rot)) (* cy (cos rot)))) ) ) (defun ht:proj (pt base ang) (+ (* (- (car pt) (car base)) (cos ang)) (* (- (cadr pt) (cadr base)) (sin ang)) ) ) (defun ht:paint (layout base ang hgt wf lay sty obl from to / out p) (setq out '()) (foreach item layout (if (and (< (nth 1 item) to) (> (nth 2 item) from)) (progn (setq p (list (+ (car base) (* (nth 1 item) (cos ang))) (+ (cadr base) (* (nth 1 item) (sin ang))) 0.0 ) ) (entmake (append (list '(0 . "TEXT") '(100 . "AcDbEntity") (cons 8 lay) '(100 . "AcDbText") (cons 10 p) (cons 40 hgt) (cons 1 (car item)) (cons 50 ang) (cons 41 wf) (cons 7 sty) (cons 62 1) '(72 . 0) '(73 . 0) ) (if obl (list (cons 51 obl)) nil ) (list (cons 11 p)) ) ) (setq out (cons (entlast) out)) ) ) ) out ) (defun ht:clear (lst) (if (listp lst) (foreach e lst (if (entget e) (entdel e) ) ) ) ) (defun ht:run (sel / hEnt ed txt hgt wf sty lay obl ang base anchor-s chars layout input running gr code data cur-s hl-a hl-b hl-from hl-to i new-lst new-txt echo-last last-a last-b ) (setq hEnt (car sel) ed (entget hEnt) ) (if (/= "TEXT" (cdr (assoc 0 ed))) (princ "\n not a text") (progn (setq txt (cdr (assoc 1 ed)) hgt (cdr (assoc 40 ed)) wf (cond ((cdr (assoc 41 ed))) (t 1.0) ) sty (cond ((cdr (assoc 7 ed))) (t "Standard") ) lay (cdr (assoc 8 ed)) obl (cdr (assoc 51 ed)) ang (cond ((cdr (assoc 50 ed))) (t 0.0) ) base (ht:origin ed) anchor-s (ht:proj (cadr sel) base ang) chars (ht:chars txt) layout (ht:layout chars hgt wf sty obl) ) (princ "\n move mouse to change text") (setq running T input "" echo-last 0 *ht-tmp* '() last-a nil last-b nil ) (while running (setq gr (grread T 13) code (car gr) data (cadr gr) ) (cond ((= code 5) (setq cur-s (ht:proj data base ang) hl-from (min anchor-s cur-s) hl-to (max anchor-s cur-s) hl-a nil hl-b nil i 0 ) (foreach item layout (if (and (< (nth 1 item) hl-to) (> (nth 2 item) hl-from)) (progn (if (null hl-a) (setq hl-a i) ) (setq hl-b i) ) ) (setq i (1+ i)) ) (if (or (/= hl-a last-a) (/= hl-b last-b)) (progn (ht:clear *ht-tmp*) (setq *ht-tmp* (if hl-a (ht:paint layout base ang hgt wf lay sty obl hl-from hl-to ) '() ) ) (setq last-a hl-a last-b hl-b ) ) ) ) ((= code 2) (cond ((member data '(13 32)) (if (null hl-a) (princ "\n No char to hightlight") (progn (setq i 0 new-lst '() ) (foreach ch chars (cond ((< i hl-a) (setq new-lst (cons ch new-lst))) ((= i hl-a) (if (> (strlen input) 0) (foreach nc (ht:chars input) (setq new-lst (cons nc new-lst)) ) ) ) ((> i hl-b) (setq new-lst (cons ch new-lst))) (t nil) ) (setq i (1+ i)) ) (setq new-txt (apply 'strcat (reverse new-lst))) (if (= new-txt "") (setq new-txt " ") ) (entmod (subst (cons 1 new-txt) (assoc 1 ed) ed)) (entupd hEnt) (princ (strcat "\n Result: " new-txt)) ) ) (setq running nil) ) ((= data 8) (if (> (strlen input) 0) (setq input (substr input 1 (1- (strlen input)))) ) ) ((= data 27) (setq running nil)) ((and (>= data 32) (< data 127)) (setq input (strcat input (chr data))) ) ) (if running (progn (princ (strcat "\r Input: " input)) (if (< (strlen input) echo-last) (princ (make-string (- echo-last (strlen input)) 32)) ) (setq echo-last (strlen input)) ) ) ) ((member code '(3 11 25)) (setq running nil)) ) ) (princ) ) ) ) (defun c:HTEXT (/ sel res) (setq sel (entsel "\n select a text <exit>: ")) (if (null sel) (princ "\n nothing selected") (progn (setq *ht-tmp* '()) (setq res (vl-catch-all-apply 'ht:run (list sel))) (ht:clear *ht-tmp*) (setq *ht-tmp* nil) (if (vl-catch-all-error-p res) (princ (strcat "\n error: " (vl-catch-all-error-message res)) ) (terpri) ) ) ) (princ) )
-
zs123 joined the community
-
this was a fun challenge using KDTrees https://www.theswamp.org/index.php?topic=59487.0
-
Do you really need a separate DWG for every revision?
BIGAL replied to indiancad's topic in AutoCAD Drawing Management & Output
Like others if a revision then a dwg was saved. We also saved a "AS Built" dwg, all our dwg's were recorded and could be looked up, we went back to 1999. They were saved as Tiffs later on as Pdf's. As we controlled the dwg's in regards to access by others, server locked, we made sure only the latest version was in the current working directory, we had a superseded directory. As part of document control a new project had specific directories premade.
