All Activity
- Past hour
-
How to show inch marks ( double quote ) after a decimal dimension?
mhupp replied to ILoveMadoka's topic in SolidWorks
100% agree. I'd take BIGAL's route but idk if it would suffer from the same issue as my first screenshot. but the macro could be used to update old drawings easily. Coming from cad one of my main grips about solidworks was the customization and how you had to go digging around menus to change things. But I inderstand why it's that way. Did see if you had a dimension selected in the option panel you could go to other tab > override > feet inch and it would use like 3' - 6“ but if it was less than 12" it would only use in. Our drawings only show the number and just have a note in the title block saying. all dimensions are in inches unless otherwise called out. We have some Europe contracts so we will have to do things in metric from time to time. -
Impossible to change attribute text size within dynamic block
jamami replied to jamami's topic in AutoCAD Drawing Management & Output
hi again.... i see this offers a solution to update attributes within nested blocks, however my issue is that i need to change the size of the text depending on what scale i intend to show at. I had foolishly assumed that defining a unique text style would give this control, but this doesn't work as when defining attributes a size needs to be specified. - Today
-
Impossible to change attribute text size within dynamic block
SLW210 replied to jamami's topic in AutoCAD Drawing Management & Output
It seems you posted this here as well... Attribute text size not changing in dynamic block - Autodesk Community You need to run ATTSYNC on the block, but, how you made the block, when trying to use ATTSYNC it reports the block has NO ATTRIBUTES. You added the visibility states into the block as nested Items, easy solution is to update the nested blocks with LISP. Maybe... Solved: Update attributes of nested blocks in dynamic blocks - Autodesk Community -
Yes, GP_'s need Express Tools AFAIK. As I posted, It still is off from yours on some corners. It also creates lines and splines, though easy enough to make them polylines.
-
How to show inch marks ( double quote ) after a decimal dimension?
SLW210 replied to ILoveMadoka's topic in SolidWorks
Still a lot of work for what should be easy and already available. When I used Solidworks I was mostly lucky in using either Metric or Architectural with fractions. I would have done some for the machine shop in Decimal inches, IIRC, I added the (" ) in AutoCAD when I made the detail drawing. -
I haven't looked at @Lee Mac's, but I use this one. There may be newer than version 5.0 at the Swamp or here. Allows selecting what to remove. Solved: strip mtext formatting - Autodesk Community More reading and information from John Uhden, I also use his versions, the original lets you select what to remove, which may be in one of the threads. Re: StripMText Issue - Autodesk Community
-
Isabela joined the community -
mr_fiftik joined the community
-
Python, Extract Polyline Lengths with Associated Text Labels in AutoCAD
Danielm103 replied to Danielm103's topic in .NET, ObjectARX & VBA
see https://github.com/CEXT-Dan/PyRx -
Lisp for to get y value of polyline based on datum value and line.
Saxlle replied to Ish's topic in AutoLISP, Visual LISP & DCL
Can you provide the an example drawing? I'm not familiar with working in Civil 3D.- 11 replies
-
Extract Polyline Lengths with Associated Text Labels in AutoCAD
Saxlle replied to Tamim's topic in AutoLISP, Visual LISP & DCL
The reason is: "no polylines are selected, so the Lengths of the polyline were not obtained". As I can see in the another file example, it's different from the original "Line Length Sample", so the code will not work as expected. I agree with @Danielm103 wath he said (standardized label = height, position below/above polyline, etc.). -
How to work with closed drawing(s) in Python (ObjectDBX)
Danielm103 replied to Danielm103's topic in .NET, ObjectARX & VBA
Working with the layout manager in a side database context, LayoutManager methods have overloads that take a database argument import traceback from pyrx import Db, Ed, Ge, Ap, Rx, Gs from timeit import default_timer as timer from collections import defaultdict def processDWG(db: Db.Database, allLayouts: dict[list]): lm = Db.LayoutManager() # LayoutManager methods have overloads that take a database argument # here we just want to get the layout names for layoutName, LayoutId in lm.getLayouts(db).items(): allLayouts[db.getFilename()].append(layoutName) # example if we want to search for title blocks # ignore the model tab if not "MODEL".casefold() in layoutName.casefold(): layout = Db.Layout(LayoutId) ps = Db.BlockTableRecord(layout.getBlockTableRecordId()) for id in ps.objectIds(Db.BlockReference.desc()): ref = Db.BlockReference(id) print(ref.getBlockName()) def readDWG(file: str, allLayouts): sideDb = Db.Database(False, True) sideDb.readDwgFile(file) sideDb.closeInput(True) processDWG(sideDb, allLayouts) @Ap.Command() def doit(): try: start = timer() allLayouts = defaultdict(list) for file in Ap.Application.listFilesInPath("E:\\temp", ".dwg"): readDWG(file, allLayouts) print("Time = {} seconds: ".format(timer() - start)) for k, v in allLayouts.items(): print(k, v) except Exception as err: traceback.print_exception(err) Command: DOIT Project data <--- a block I added to paperspace, could be a title block Time = 0.0780531999989762 seconds: E:\temp\Floor Plan Sample1.dwg ['Layout1', 'Model'] E:\temp\Floor Plan Sample2.dwg ['Layout1', 'Model'] E:\temp\Floor Plan Sample3.dwg ['Layout1', 'Model'] E:\temp\Floor Plan Sample4.dwg ['Layout1', 'Model'] E:\temp\Floor Plan Sample5.dwg ['Layout1', 'Model'] E:\temp\Floor Plan Sample6.dwg ['Layout1', 'Model'] E:\temp\Floor Plan Sample7.dwg ['Layout1', 'Model'] E:\temp\Floor Plan Sample8.dwg ['Layout1', 'Layout2', 'Model'] -
azuniga074 joined the community
-
Seneca said: “Homines dum docent discunt.” Which, roughly, means: Learn to explain and explain to learn
-
Yes. Part of the problem is with arcs whose initial angle (group 50 in the database) is greater than the final angle (group 51 in the database). But you also have to specify point p2 inside the arc so that it's drawn in the correct location. I had to spend a bit of time figuring this out. (defun C:bm (/ obj num i obj1 db ct rd a1 a2 p1 p2 r ptlist osmant) (setq osmant (getvar "OSMODE")) (setvar "osmode" 0) ; Turn off OSNAP (setq obj (ssget '((0 . "LWPOLYLINE,ARC")))) (setq num (sslength obj)) (setq i 0) (repeat num (setq obj1 (ssname obj i)) (setq db (entget obj1) ptlist (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) db)) ) (if (= (cdr (assoc 0 db)) "ARC") (progn (setq ct (cdr (assoc 10 db))) (setq rd (cdr (assoc 40 db))) (setq a1 (cdr (assoc 50 db)); angulo inicial del arco a2 (cdr (assoc 51 db)); angulo final del arco ) (setq a (if (> a1 a2) (+ a1 (/ (- (* 2. PI) (- a1 a2) ) 2.)) (/ (+ a1 a2) 2.))) (setq p1 (polar ct a1 rd)) (setq p2 (polar ct a (* rd 0.9))) (setq p3 (polar ct a (* rd 1.1))) (command "_.dimradius" "_non" p1 "_non" p2 "") (command "_.dimarc" "_non" p1 "_non" p3 "") ) ;progn ;;; (progn ;polyline arc segment ;;;;;code (foreach l db (if (= (car l) 10) (if p1 (if bulge (progn (command "_.dimradius" "_non" p1 "_non" (cdr l) "") (command "_.dimarc" "_non" p1 "_non" (setq p1 (cdr l)) "") ; ) ) (setq p1 (cdr l)) ) (if (= (car l) 42) (setq bulge (/= (cdr l) 0.0))) ) ) ;progn ) (setq i (1+ i)) ) ;repeat end ; Turn off OSNAP (setvar "osmode" osmant) (princ) )
-
The DIMRADIUS and DIMARC commands are very fickle. I've used them very little so far. But thanks to you, I'm a little more familiar with them now. So I guess I owe you a favor for that.
-
How to work with closed drawing(s) in Python (ObjectDBX)
Danielm103 replied to Danielm103's topic in .NET, ObjectARX & VBA
The working database https://help.autodesk.com/view/OARX/2025/ENU/?guid=OARX-RefGuide-AcDbHostApplicationServices__workingDatabase AcDbHostApplicationServices::workingDatabase AcDbHostApplicationServices::setWorkingDatabase It’s mostly legacy stuff at this point; there are some function calls in ObjectARX that do not have a database parameter. They work assuming that that the working database has been set. This is the same sample as above, but we use AutoWorkingDatabase import traceback from pyrx import Db, Ed, Ge, Ap, Rx, Gs from timeit import default_timer as timer from collections import defaultdict def processDWG(allphones: dict[int]): # shortcut to # Db.HostApplicationServices.workingDatabase() db = Db.workingDb() refs = [Db.BlockReference(id) for id in db.objectIds(Db.BlockReference.desc())] for ref in refs: if ref.getBlockName() != "FNPHONE": continue allphones[db.getFilename()] += 1 def readDWG(file: str, allphones): sideDb = Db.Database(False, True) sideDb.readDwgFile(file) sideDb.closeInput(True) # use RAII to set and restore the working db wdb = Db.AutoWorkingDatabase(sideDb) processDWG(allphones) @Ap.Command() def doit(): try: start = timer() # read all text from a collection of drawings allphones = defaultdict(int) for file in Ap.Application.listFilesInPath("E:\\temp", ".dwg"): readDWG(file, allphones) print("Time = {} seconds: ".format(timer() - start)) for k, v in allphones.items(): print(k, v) except Exception as err: traceback.print_exception(err) same output Command: DOIT Time = 0.12193889999980456 seconds: E:\temp\Floor Plan Sample1.dwg 51 E:\temp\Floor Plan Sample2.dwg 51 E:\temp\Floor Plan Sample3.dwg 51 E:\temp\Floor Plan Sample4.dwg 51 E:\temp\Floor Plan Sample5.dwg 51 E:\temp\Floor Plan Sample6.dwg 51 E:\temp\Floor Plan Sample7.dwg 51 E:\temp\Floor Plan Sample8.dwg 51 -
Excuse my incompetence... I have thousands of mtext objects from a GIS package that comes out with a text and height override in the text string. I believe UnFormat can remove this but I cannot figure out how to execute it correctly. Example text string is - \fOpen Sans|i0|b0;\H1.88516;93\PDP750380 I would like to retain 93\PDP750380 in the mtext object without removing the stacking and also the text before and after the stacking is different in each mtext object to which I would like this applied. Thanks
-
Madbike21 joined the community
-
How to work with closed drawing(s) in Python (ObjectDBX)
Danielm103 replied to Danielm103's topic in .NET, ObjectARX & VBA
If you notice, everywhere a class or function returns an objectId collection, you can apply a type filter refs = [Db.BlockReference(id) for id in db.objectIds(Db.BlockReference.desc())] -
How to work with closed drawing(s) in Python (ObjectDBX)
Danielm103 replied to Danielm103's topic in .NET, ObjectARX & VBA
One thing to keep in mind, is that way python’s garbage collector works; First created, First deleted. We want to break up the functions to ensure that the side database is not deleted before any of it’s objects. This example, we will iterate though all eight files and count the number of phones by floor import traceback from pyrx import Db, Ed, Ge, Ap, Rx, Gs from timeit import default_timer as timer from collections import defaultdict def processDWG(db: Db.Database, allphones: dict[int]): # scan the entire database for blocks, this is a tad slower than just scanning # modelspace refs = [Db.BlockReference(id) for id in db.objectIds(Db.BlockReference.desc())] for ref in refs: if ref.getBlockName() != "FNPHONE": continue allphones[db.getFilename()] += 1 def readDWG(file: str, allphones): # we reading an already created drawing, so change # buildDefaultDrawing: bool = False, # noDocument: bool = True # we want to keep this in a seperate function sideDb = Db.Database(False, True) sideDb.readDwgFile(file) sideDb.closeInput(True) processDWG(sideDb, allphones) @Ap.Command() def doit(): try: start = timer() # read all text from a collection of drawings allphones = defaultdict(int) for file in Ap.Application.listFilesInPath("E:\\temp", ".dwg"): readDWG(file, allphones) print("Time = {} seconds: ".format(timer() - start)) for k, v in allphones.items(): print(k, v) except Exception as err: traceback.print_exception(err) Command: DOIT Time = 0.1402779999998529 seconds: E:\temp\Floor Plan Sample1.dwg 51 E:\temp\Floor Plan Sample2.dwg 51 E:\temp\Floor Plan Sample3.dwg 51 E:\temp\Floor Plan Sample4.dwg 51 E:\temp\Floor Plan Sample5.dwg 51 E:\temp\Floor Plan Sample6.dwg 51 E:\temp\Floor Plan Sample7.dwg 51 E:\temp\Floor Plan Sample8.dwg 51 - Yesterday
-
Danielm103 started following How to work with closed drawing(s) in Python (ObjectDBX)
-
How to work with closed drawing(s) in Python (ObjectDBX)
Danielm103 posted a topic in .NET, ObjectARX & VBA
For these examples, I’ll be working with a folder with copies of the same drawing, pretend they’re floors of the same building or something -
Extract Polyline Lengths with Associated Text Labels in AutoCAD
Danielm103 replied to Tamim's topic in AutoLISP, Visual LISP & DCL
You changed label format, the lisp routine trying to sort the strings by extracting the number at the 3rd position L-1 – L32 You will need to fix it to extract the number from XXX-XXX-1(20) The issue is, we don’t know if XXX-XXX will eventually contain a number I.e. A23-ACB-1(20) We don’t know what number you want the labels sorted by. Think about this and report back when you have a standardized label -
Lisp for to get y value of polyline based on datum value and line.
BIGAL replied to Ish's topic in AutoLISP, Visual LISP & DCL
Trying to add the purple line values will introduce a new problem of overlapping text. trying to remember with CIV3D add extra pts in a long section in particular, one way is add that chainage as part of the alignment. Using say Civil Site Design it has this add extra chainages feature built in. Runs in Civ3D. You can do a mini range start-end chainge, spacing and so on.- 11 replies
-
mhupp started following How to show inch marks ( double quote ) after a decimal dimension?
-
How to show inch marks ( double quote ) after a decimal dimension?
mhupp replied to ILoveMadoka's topic in SolidWorks
Better late the never this will add a " to the end of dimensions for a drawing that is set to IPS. tho doesn't work quite right when tolerances are used. will also prompt you if you are going to overwrite any data Sub addtick() Dim swApp As SldWorks.SldWorks, swModel As SldWorks.ModelDoc2, swDraw As SldWorks.DrawingDoc Dim swView As SldWorks.View, swDispDim As SldWorks.DisplayDimension, swDim As SldWorks.Dimension Dim unitSystem As Long, okRun As Boolean, sCurrSuffix As String, id As String Set swApp = Application.SldWorks Set swModel = swApp.ActiveDoc If swModel Is Nothing Then MsgBox "No active document.", vbExclamation, "Add Inch Tick" Exit Sub End If If swModel.GetType <> swDocDRAWING Then MsgBox "This macro only runs on drawings.", vbExclamation, "Add Inch Tick" Exit Sub End If unitSystem = swModel.Extension.GetUserPreferenceInteger( _ swUserPreferenceIntegerValue_e.swUnitSystem, _ swUserPreferenceOption_e.swDetailingNoOptionSpecified) If unitSystem <> swUnitSystem_e.swUnitSystem_IPS Then MsgBox "This macro will only run in IPS(Inch, Pound, Second) Drawing.", vbExclamation, "Add Inch Tick" Exit Sub End If Set swDraw = swModel Set swView = swDraw.GetFirstView Do While Not swView Is Nothing Set swDispDim = swView.GetFirstDisplayDimension5 Do While Not swDispDim Is Nothing Set swDim = swDispDim.GetDimension sCurrSuffix = swDispDim.GetText(swDimensionTextSuffix) If sCurrSuffix <> "" And Not sCurrSuffix = """" Then If MsgBox("Overwrite """ & sCurrSuffix & """?", vbQuestion + vbYesNo) = vbYes Then swDispDim.SetText swDimensionTextSuffix, """" End If Else swDispDim.SetText swDimensionTextSuffix, """" End If Set swDispDim = swDispDim.GetNext3 Loop Set swView = swView.GetNextView Loop swModel.GraphicsRedraw2 MsgBox "Ticks Added to Drawing" End Sub -
Lisp for to get y value of polyline based on datum value and line.
symoin replied to Ish's topic in AutoLISP, Visual LISP & DCL
Here, I have the profile generated from Civil 3D. The elevations and stations are generated at every 25m interval (white lines), but the crossings are not included. So if I get a lisp that will generate the staion and elevations for the crossings (pink lines) same as the details for the white lines. with your Yval we can get the elevations but need the stations also.- 11 replies
-
Assigning Elevations to Polylines from Text.
ronjonp replied to Bill_Myron's topic in AutoLISP, Visual LISP & DCL
-
NJJerrySmith joined the community
-
VS Code migration 3 weeks ago: smashingly successful incl ai (!!!), but having trouble now using the console and loading code
hawstom replied to hawstom's topic in AutoLISP, Visual LISP & DCL
Well, for the DEBUG CONSOLE, I stumbled on the problem when I wasn't searching. I had a filter active. On deleting it, suddenly I saw all the blue reports. Yay!
