All Activity
- Past hour
-
jamami started following Impossible to change attribute text size within dynamic block
-
Impossible to change attribute text size within dynamic block
jamami posted a topic in AutoCAD Drawing Management & Output
I regularly use the attached dynamic block but have a big issue in that I cannot control the attribute text size without having to explode and then individually edit every bock. The attribute is defined with a unique text style and was hoping to use that to control but this does not work, nor does trying to use annotative elements. I tried making the text style annotative, the block it is part of and the dynamic block that contains the sub blocks - no luck. Is there a solution to this? Beam.dwg -
OP's AxisExample.dwg shows DWG file was saved by an application that was not developed or licensed by Autodesk. Both Gian's @GP_ and Daniel's @Danielm103 are still slightly off from @PGia manual examples. With @GP_ CPL I get... Command: CPL Cannot invoke (command) from *error* without prior call to (*push-error-using-command*). Converting (command) calls to (command-s) is recommended. But it runs.. here is OP's (blue) and Gian's (white).
-
toni joined the community
-
Assigning Elevations to Polylines from Text.
toni replied to Bill_Myron's topic in AutoLISP, Visual LISP & DCL
I tried installing this, but I get the following text in the command prompt - "error: extra cdrs in dotted pair on input". Does anyone know how to fix the error? -
Python, Extract Polyline Lengths with Associated Text Labels in AutoCAD
Tamim replied to Danielm103's topic in .NET, ObjectARX & VBA
How to use CAD? - Today
-
frank1971 joined the community
-
Hi, CADTutor people! I'd love to share my exciting success. And I need a little help if anybody can give it. I've been programming in AutoLISP for 30 years (remember XTree Gold, the Kelvinator, and that colorful DOS lisp editor?), and I decided to give VS Code yet another try on Oct 4. It was generally successful enough that I decided to commit to it. Then one week ago I happened upon a tutorial for the Copilot AI agent, fired it up with Claude Sonnet (based on hive mind advice), and have been in heaven (and not sleeping) all week; I have a lot of pent-up wish list for open source project CNM from myself and users, and I am getting old and (sometimes) tired. Claude Sonnet under Copilot is amazing! But about VS Code: On the whole I am still not looking back, especially with the AI helps and agent. I even like the debugger a lot. And I plan to have ai help me write a little FAS compiler loop. But I don't like the AutoLISP Extension's formatter. And for the life of me I cannot read the minds of the programmers when it comes to loading code. To make matters worse, in the last few days I can figure out how to load code or get the Console to respond. Here's a bug report in case there are great masters about this here: I used to see blue text in the output (or console?) area at the bottom stating what files were loaded. And I could put expressions in the Console. But now I can't get either one to work. I see that there is a green Restart circle at the top and a blue "Load lisp" button on the bottom status bar. The blue status bar and green restart circle indicate that a debug session is running, or in other words that AutoCAD is connected. But it was dismaying to me to learn that the green restart button can load only the file that was active when debugging started. You can't switch to another file and load it without disconnecting and starting a new debug session. You can use the blue "Load lisp" to load other files. But more than half the time that would fail with an incomprehensible message that it could not be loaded because it has changed. "Well, yeah! That's why I want to load it." I see that Autodesk says "Tip: If you need to debug multiple LSP files, it is recommended to load those files with the AutoLISP LOAD function in the LSP file that is in the active editor window before starting a new debug session." So maybe they never could get this to work the way they wanted to. The good news is that if you load from AutoCAD, you still can debug. So all this is not a deal killer. I reinstalled the extension. Maybe I need to reinstall VS Code (again). Any ideas, or just want to talk about my amazing experience with Copilot/Claude? Tom
-
Extract Polyline Lengths with Associated Text Labels in AutoCAD
Tamim replied to Tamim's topic in AutoLISP, Visual LISP & DCL
hi, this Lips working pefrect but this one i used other cad file cant work result shows" Select all TEXT entities: Select objects: Specify opposite corner: 12 found Select objects: ; error: bad argument type: lselsetp nil" advice pls Line Length Sample v2.dwg -
sereyvathra joined the community
-
Lisp for to get y value of police based on datum value and line.
Saxlle replied to Ish's topic in AutoLISP, Visual LISP & DCL
Hi @symoin If you can provide the an example file with explanations inside of what you want, I can try it to modified the code for your purposes. Best regards. -
@devitg sample dwg upload for reference @GLAVCVS It may not function correctly, possibly due to the direction(clockwise or counterclockwise) of the arc or because it does not meet the point on the arc. mb.dwg
-
SelectionSet class methods class SelectionSet: def add(self, id: Db.ObjectId, /) -> None: ... def adsname(self, /) -> Db.AdsName: ... def clear(self, /) -> None: ... def hasMember(self, id: Db.ObjectId, /) -> bool: ... def objectIdArray(self, desc: Rx.RxClass = Db.Entity, /) -> Db.ObjectIdArray: ... def objectIds(self, desc: Rx.RxClass = Db.Entity, /) -> list[Db.ObjectId]: ... def remove(self, id: Db.ObjectId, /) -> None: ... def size(self, /) -> int: ... def ssNameX(self, val: int = 0, /) -> list: ... def ssSetFirst(self, /) -> bool: ... def ssXform(self, xform: Ge.Matrix3d, /) -> Ed.PromptStatus: ... def toList(self, /) -> list[Db.ObjectId]: ... Note, ObjectIdArray is basically the same as list[Db.ObjectId], but the memory is allocated in C++ instead of Python. There may be performance reasons to choose one of the the other, but for now, they can be used interchangeably
-
Lets say we want only lines and arcs, but still want to use AcDbCurve class, pass a list of descriptions # returns a PromptStatus and a SelectionSet class ps, ss = Ed.Editor.select([(8, "0")]) if ps != Ed.PromptStatus.eOk: raise RuntimeError("Selection Error! {}: ".format(ps)) curves = [Db.Curve(id) for id in ss.objectIds([Db.Line.desc(),Db.Arc.desc()])] for curve in curves: print(curve.getDistAtParam(curve.getEndParam()))
-
Support derived types, Lets say you want to get all the objects in the set that are derived from AcDbCurve, to do some sort of base class operation (AcDb2dPolyline, AcDb3dPolyline, AcDbArc, AcDbCircle, AcDbEllipse, AcDbLeader, AcDbLine, AcDbPolyline, AcDbRay, AcDbSpline, AcDbXline) # returns a PromptStatus and a SelectionSet class ps, ss = Ed.Editor.select([(8, "0")]) if ps != Ed.PromptStatus.eOk: raise RuntimeError("Selection Error! {}: ".format(ps)) curves = [Db.Curve(id) for id in ss.objectIds(Db.Curve.desc())] for curve in curves: print(curve.getDistAtParam(curve.getEndParam()))
-
The real power is post filtering entity types, for example, we want the selection set to filter the visual selection set on screen, but then we want to separate out objects by type. SelectionSet.objectIds() method is overloaded to take an entity class description and returns the types that match. it does not open the object, so it’s extremely fast #returns a PromptStatus and a SelectionSet class ps, ss = Ed.Editor.select([(0, "TEXT,LWPOLYLINE,LINE")]) if ps != Ed.PromptStatus.eOk: raise RuntimeError("Selection Error! {}: ".format(ps)) # create a list of entites ant are opened for read texts = [Db.Text(id) for id in ss.objectIds(Db.Text.desc())] lines = [Db.Line(id) for id in ss.objectIds(Db.Line.desc())] plines = [Db.Polyline(id) for id in ss.objectIds(Db.Polyline.desc())] for text in texts: pass # do something for line in lines: pass # do something for pline in plines: pass # do something
-
The SelectionSet class is an enumerable collection of ObjectIds, example #returns a PromptStatus and a SelectionSet class ps, ss = Ed.Editor.select() for id in ss: ent = Db.Entity(id) print(ent.isA().dxfName())
-
SelectionSet filters can also be inline Ed.Editor.select([(0, "TEXT,LWPOLYLINE,LINE")])
-
Danielm103 started following Selection sets in Python.
-
Filters Instead of creating a dedicated ResultBuffer class like in .NET, I decided to build a wrapper for Python’s built in types. Throughout the API, resbuf* or ResultBuffer are simply a list of tuples, in the format of a group code and a value typedValues = [(TYPE, VALUE)] Depending on the context the group code may be a Lisp type code, or in the case of selection sets, DXF codes. Here are two possible formats # long format filter = [ (Db.DxfCode.kDxfStart, "TEXT,LWPOLYLINE,LINE"), (Db.DxfCode.kDxfOperator, "<OR"), (Db.DxfCode.kDxfLayerName, "0"), (Db.DxfCode.kDxfLayerName, "8"), (Db.DxfCode.kDxfOperator, "OR>"), ] # short format filter = [ (0, "TEXT,LWPOLYLINE,LINE"), (-4, "<OR"), (8, "Layer1"), (8, "Layer2"), (8, "Layer3"), (-4, "OR>"), ]
-
Dhelviayk joined the community
-
mhupp started following Help me create a annotative dimension style and text style style
-
annotative text style Help me create a annotative dimension style and text style style
mhupp replied to sachindkini's topic in AutoLISP, Visual LISP & DCL
Entmake text style. (entmake '((0 . "STYLE") (100 . "AcDbSymbolTableRecord") (100 . "AcDbTextStyleTableRecord") (2 . "style name here") (70 . 0) (40 . 0.0) (41 . 1.0) (50 . 0.0) (71 . 0) (42 . 1.0) (3 . "Arial.ttf") (4 . "") ) ) use setvar for dimstyles nothing will be outputted to command prompt. (setvar 'DIMADEC 2) (setvar 'DIMALT "off") I think @Steven P has dug into this more. - Yesterday
-
AUTOLISP FIELD AREA FOR PL BUG
BIGAL replied to Gabriel Paixão's topic in AutoLISP, Visual LISP & DCL
Also this as mentioned. (setq ent (entget (car (entsel "\nPick an object for layer name ")))) (setq MyLayerName (cdr (assoc 8 ent))) (setq allPolylines (ssget "_X" (list (0 . "*POLYLINE")(cons 8 MyLayerName)))) -
annotative text style Help me create a annotative dimension style and text style style
BIGAL replied to sachindkini's topic in AutoLISP, Visual LISP & DCL
I think you need to look at Entmake a style whether its a text style or a dimension style rather than trying to override current settings. trying to find a good simple example some else may have one. -
Steven P started following AUTOLISP FIELD AREA FOR PL BUG
-
AUTOLISP FIELD AREA FOR PL BUG
Steven P replied to Gabriel Paixão's topic in AutoLISP, Visual LISP & DCL
If it was me I would allow the user to select an entity on the layer rather than typing it in, or use something like BigAls multi getvals to select the layer from a list - saves typing errors. You can add to filters in the selection set: (setq allPolylines (ssget "_X" (list (0 . "*POLYLINE")(cons 8 MyLayerName)))) Note here that list is used if you want any of the filters to be programmatically. 'cons' used to construct the list and MyLayerName is a variable you might want to work out earlier in the LISP. Lee Mac has a very good explanation on his website for ssget. You can loop through your selection set and perhaps this snippet will help: ;;https://www.cadtutor.net/forum/topic/66091-centre-of-hatch/ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun c:CtrCoo (/ findctr a apt) ;;Center point of a hatch or a rectangle (defun findctr (en / pt) (command "_.Zoom" "_Object" en "") (setq pt (getvar 'viewctr)) (command "_.Zoom" "_Previous") pt ) (setq a (car (entsel "Select Rectangle: : ")) apt (findctr a) ) (command "_Text" "_Justify" "_MC" apt 0.1 0 apt) (princ) ) Copy FindCtr and use that to get the centre point of each object, using that as the insert point for the mtext. Maybe this will help you along? -
symoin started following Lisp for to get y value of police based on datum value and line.
-
Lisp for to get y value of police based on datum value and line.
symoin replied to Ish's topic in AutoLISP, Visual LISP & DCL
hi This is a very good lisp, can this be still upgraded to show the station of the selected lines also, at a certain distance south. like 20 or something. -
The result looks geometrically perfect I also started writing something on Friday with a similar approach. I'll post it when I finish it.
-
The result looks geometrically perfect I also started writing something on Friday with a similar approach. I'll post it when I finish it.
-
GP_ started following Hybrid parallel
-
-
-
sachindkini started following Help me create a annotative dimension style and text style style
-
annotative text style Help me create a annotative dimension style and text style style
sachindkini posted a topic in AutoLISP, Visual LISP & DCL
Dear All, im trying create a annotative dimension style and text style style . annotation text style link to annotation dimstyle . create text style and dimethyl but annotative symbole not shown in dimension style and also text style )DIM-100 & DIM-200 is annotative dimension style) (defun c:TEST () (setvar "cmdecho" 0) (setvar "expert" 0) (command "undo" "be") (princ "\nFunction: Quickly create new dimension styles.\n") (if (not (tblsearch "STYLE" "STANDARD")) (command "style" "Standard" "txt" "" "1" "" "" "") ) (if (not (tblsearch "STYLE" "STANDARD")) (command ".-style" "STANDARD" "TXT" "0" "1" "0" "N" "N" "N") ) (command "dimadec" "2" "dimalt" "off" "dimalttz" "1" "dimaltu" "2" "dimassoc" "2" "dimasz" "1" "dimatfit" "3" "dimaunit" "0" "dimazin" "0" "dimblk" "_ARCHTICK" "dimcen" "0" "dimclrd" "0" "dimclre" "0" "dimclrt" "0" "dimdec" "2" "dimdle" "0.00" "dimdli" "0.05" "dimdsep" "." "dimexe" "0.35" "dimexo" "0.35" "dimfxlon" "off" "dimgap" "0.5" "dimjust" "0" "dimldrblk" "_ARCHTICK" "dimlfac" "1" "dimlunit" "2" "dimscale" "1" "dimtad" "1" "dimtdec" "2" "dimtfac" "1" "dimtfill" "0" "dimtfillclr" "0" "dimtih" "off" "dimtix" "off" "dimtmove" "0" "dimtofl" "on" "dimtol" "off" "dimtolj" "1" "dimtxsty" "Standard" "dimtxt" "2.5" "dimtzin" "1" "dimupt" "off" "dimzin" "1" ) (if (not (tblsearch "dimstyle" "TEST-123")) (command "dimstyle" "S" "TEST-123") ) ;; -------------------------------------- (if (not (tblsearch "STYLE" "TEST-100")) (command ".-style" "TEST-100" "Calibri" "0" "1" "0" "N" "N" "N") ) (setvar "DIMTOL" 1) (setvar "DIMTM" 0.05) (setvar "DIMTP" 0.05) (setvar "DIMTXSTY" "TEST-100") ;; Create or update dimension style (if (not (tblsearch "dimstyle" "DIM-100")) (progn (command ".-dimstyle" "S" "DIM-100") ) (command ".-dimstyle" "R" "DIM-100") ) ;; -------------------------------------- (if (not (tblsearch "STYLE" "TEST-200")) (command ".-style" "TEST-200" "ARIAL" "0" "1" "0" "N" "N" "N") ) (setvar "DIMTOL" 1) (setvar "DIMTM" 0.10) (setvar "DIMTP" 0.10) (setvar "DIMTXSTY" "TEST-200") (if (not (tblsearch "dimstyle" "DIM-200")) (progn (command ".-dimstyle" "S" "DIM-200") ) (command ".-dimstyle" "R" "DIM-200") ) (command "undo" "e") (alert "\nPrompt:\nDimension style creation completed!\n") (princ) ) OPT-2 THIS OPTION TEXT STYLE NOT CRETED IN ANNOTATIVE STYLE AND ONE MORE QUERT I WANT TEST-123 IS NORMAL DIM STYLE (defun c:TEST (/ oldcmdecho oldexpert) (setq oldcmdecho (getvar "cmdecho") oldexpert (getvar "expert")) (setvar "cmdecho" 0) (setvar "expert" 5) (command "_.undo" "_begin") (if (not (tblsearch "STYLE" "Standard")) (command "_.-style" "Standard" "txt" "2.5" "" "" "" "") ) (if (not (tblsearch "STYLE" "TEST-100")) (command "_.-style" "TEST-100" "Calibri" "2.5" "" "" "" "") ) (if (not (tblsearch "STYLE" "TEST-200")) (command "_.-style" "TEST-200" "Arial" "2.5" "" "" "" "") ) (while (> (getvar "cmdactive") 0) (command "")) (if (not (tblsearch "DIMSTYLE" "TEST-123")) (progn (setvar "DIMTOL" 0) (setvar "DIMTXSTY" "Standard") (command "_.-dimstyle" "_S" "TEST-123") (while (> (getvar "cmdactive") 0) (command "")) ) ) (if (not (tblsearch "DIMSTYLE" "DIM-100")) (progn (setvar "DIMTOL" 1) (setvar "DIMTM" 0.05) (setvar "DIMTP" 0.05) (setvar "DIMTXSTY" "TEST-100") (setvar "DIMTDEC" 2) (command "_.-dimstyle" "_S" "DIM-100") (while (> (getvar "cmdactive") 0) (command "")) ) ) ;; DIM-200 - With tolerances (if (not (tblsearch "DIMSTYLE" "DIM-200")) (progn (setvar "DIMTOL" 1) (setvar "DIMTM" 0.10) (setvar "DIMTP" 0.10) (setvar "DIMTXSTY" "TEST-200") (setvar "DIMTDEC" 2) (command "_.-dimstyle" "_S" "DIM-200") (while (> (getvar "cmdactive") 0) (command "")) ) ) (command "_.undo" "_end") (setvar "cmdecho" oldcmdecho) (setvar "expert" oldexpert) (princ "\nTEST command completed successfully!") (princ) )
