All Activity
- Past hour
-
You should have said at the 1st post want to sort up to 5 items deep in a list. I had this task for something else I did. Hopefully this is a dummy of what your after. it is amost instant to make 10000 items and sort them. I apoligise I forget where I got the complex sort from regarding authors name. ; sort on up to 5 items in sub lists ; By AlanH (defun compare-elements (a b sortspec) ((lambda (x y test) (if (and (equal x y ) (cdr sortspec)) (compare-elements a b (cdr sortspec)) (apply test (list x y)) ) ) (nth (cdar sortspec) a) (nth (cdar sortspec) b) (caar sortspec) ) ) (defun complex-sort (alst sortspec) (vl-sort alst '(lambda (a b) (compare-elements a b sortspec) ) ) ) ;; Rand - Lee Mac ;; PRNG implementing a linear congruential generator with ;; parameters derived from the book 'Numerical Recipes' (defun LM:rand ( / a c m ) (setq m 4294967296.0 a 1664525.0 c 1013904223.0 $xn (rem (+ c (* a (cond ($xn) ((getvar 'date))))) m) ) (/ $xn m) ) ;; Random in Range - Lee Mac ;; Returns a pseudo-random integral number in a given range (inclusive) (defun LM:randrange ( a b ) (+ (min a b) (fix (* (LM:rand) (1+ (abs (- a b)))))) ) (defun wow ( / ) (setq lst '()) (repeat 10000 (setq v1 (atoi (rtos (LM:randrange 1 1000 ) 2 0))) (setq v2 (atof (rtos (LM:randrange 1 1000 ) 2 3))) (setq v3 (atof (rtos (LM:randrange 1 1000 ) 2 3))) (setq v4 (atof (rtos (LM:randrange 1 1000 ) 2 3))) (setq v5 (atof (rtos (LM:randrange 1 1000 ) 2 3))) (setq lst (cons (list v1 v2 v3 v4 v5) lst)) ) (setq numcols (length (car lst))) (cond ((= numcols 1)(setq lst (complex-sort lst '((< . 0))))) ((= numcols 2)(setq lst (complex-sort lst '((< . 0) (< . 1))))) ((= numcols 3)(setq lst (complex-sort lst '((< . 0) (< . 1) (< . 2))))) ((= numcols 4)(setq lst (complex-sort lst '((< . 0) (< . 1) (< . 2)(< . 3))))) ((= numcols 5)(setq lst (complex-sort lst '((< . 0) (< . 1) (< . 2)(< . 3)(< . 4))))) ((> numcols 5)(setq lst (complex-sort lst '((< . 0) (< . 1) (< . 2)(< . 3)(< . 4))))) ) (princ) ) (wow)
- Today
-
I would strongly advise against using that bubblesort function, it is horribly inefficient. (vl-sort)/(vl-sort-i) both use a version of quicksort (one of the fastest sorting algorithms), implemented in C++; as such, they will always outperform any other sorting algorithm implemented using the LISP API. If the subset is known prior to sorting then sort only the subset (since the sort is the heaviest operation); else you have no choice but to take the subset following the sort.
-
@BIGAL Thanks. I've tried Bubblesort and it seems to work well. But won't the recursive call to Bubblepass be problematic with very long lists? I've run into this problem a couple of times while doing my tests. Thank you very much, @Lee Mac I didn't know about vl-sort-i until now. After trying it, I think it's the best solution. The only drawback is that it always returns the full list of indices even though the user might only need a smaller number of elements. However, it works very fast even with very large lists, so this isn't a problem. By the way: my lists consist of lists of 5 numbers: 1 integer and 4 real numbers, which I need to sort from lowest to highest and with a preference order from left to right.
-
Yes, could be a good thing or a bad thing depending on what PGia wants to do. like I wouldn't use the entity name as the key as they are generated when opening the drawing and would be invalid next time you open said drawing. Also I think you can only store strings in the dotted pair. was only bringing as another option for a faster search of a "list".
-
nooryasser joined the community
-
FK Engineering joined the community -
Stating the obvious: just consider that creating xrecords & dictionaries is modifying the drawing database and the data is stored in the drawing, whereas LISP data is obviously transient.
-
DEnSor75 joined the community
-
Maintaining flat-pattern accuracy when exchanging sheet metal drawings
indiancad posted a topic in AutoCAD 3D Modelling & Rendering
In sheet metal design, a 3D folded model and its 2D flat pattern must agree with the actual manufacturing requirements. Small differences in bend allowance, inside radius, material thickness, or K-factor can produce incorrect developed dimensions. This becomes particularly important when drawings are prepared in one CAD application and the flat patterns are exported as DXF for CNC cutting. How do you maintain consistency between the folded model and the exported flat pattern? Do you rely on CAD-generated bend calculations, manufacturer-specific bend tables, or independently verify the developed dimensions? -
DESECURE joined the community
-
Maintaining coordinate integrity when combining survey drawings from different sources
indiancad replied to indiancad's topic in AutoCAD Drawing Management & Output
yes,Converting units is straightforward, but correcting incorrect coordinate references can create much bigger problems. -
Baseball Lighting Design in AutoCAD
indiancad replied to RadiantRiddle's topic in AutoCAD 3D Modelling & Rendering
Four 50-foot corner poles may not provide uniform coverage, especially in the deep outfield. Use photometric simulation with actual LED IES files to optimise fixture angles, beam distribution, and mounting height. Asymmetric optics and glare shields can also reduce spillover toward the seating areas. Focus on uniform field illumination rather than simply increasing brightness. -
Baseball Lighting Design in AutoCAD
AONE_LED replied to RadiantRiddle's topic in AutoCAD 3D Modelling & Rendering
Corner-only poles are the main reason for uneven outfield light and spill. Sports fields are normally lit from four poles placed outside the foul lines, not at the diamond corners, or from six to eight poles around the perimeter. Use narrow-beam floodlights with sharp cut-off optics for the deep outfield, aimed at roughly 20 to 30 degrees below horizontal, and wide-beam units for the infield. Higher aiming angles throw light into the stands, so keep tilt moderate and add external louvres or shields on the fixtures facing the seating. Typical targets are about 500 to 750 lux infield and 300 to 500 lux outfield, with uniformity (min/avg) of 0.5 or better. Verify with a point-by-point grid calculation using IES files before finalising pole positions, because AutoCAD renders cannot give reliable lux values. -
Get Lux (light) value in a specific 3d Point of my drawing
AONE_LED replied to mike42's topic in AutoCAD 3D Modelling & Rendering
AutoCAD has no tool that reads lux at an arbitrary point, so you need a workaround. Use photometric lights (set LIGHTINGUNITS to 1 or 2, define lights by candela or lumens, ideally with an IES web file) and render with a photometric exposure setting. Pixel brightness in a render is only a visual indication, not a calibrated lux reading. For an actual value at a point, use the inverse square law, E = I x cos(theta) / d squared, taking the candela from the IES file in the direction of the point; measure at working height, normally 0.8 m for a desk or floor level for corridors. For a real design, export the luminaires to a dedicated lighting calculation program that outputs a lux grid on the working plane. -
Dictionary is an object in the drawing file. (setq mainDict (namedobjdict)) (dictadd mainDict "PART001" ;this is they unique key (entmakex '((0 . "XRECORD") ;needed (100 . "AcDbXrecord") ;needed (1 . "Steel") (2 . "Description") (3 . "12.5") (4 . "24") (5 . "100") (6 . "Black") ) ) ) (setq color (cdr (assoc 6 (dictsearch Maindict "PART001")))) So the main "list" or Dictionary is mainDict you then need a key to store the sub list under "PART001" and then as many dotted pairs as you want. dictsearch would be alot faster than assoc with 20,000 list.
- Yesterday
-
How to bring OpenStreetMap streets and buildings into AutoCAD (DWG/DXF) — what actually works
BIGAL replied to OSM2CDR's topic in AutoCAD Beginners' Area
Welcome aboard. There are various other ways of getting street maps, as I worked for a government authority had access to vector, images and 3d Lidar. You can approach authorities for maps, may be a cost. Google earth ? -
Maintaining coordinate integrity when combining survey drawings from different sources
BIGAL replied to indiancad's topic in AutoCAD Drawing Management & Output
Working for a government Authority if a dwg was provided at 0,0. It would be quickly rejected and the company asked to fix at correct world co-ordinates especially if they wanted to be paid. Doubtful we would use them again. We worked on roads fully surveyed say 5km in length. Personally @indiancad dont see this as a question rather make sure your contract regarding co-ordinates is clearly stated. Ps yes had architects plans in mm we did have to convert to m but had advantage of survey control points in those dwg's as the initial supplied field data was world true. -
Like @SLW210 depends on how the appliances are laid out in the dwg if in say a grid then all can be exported in one go, if have to select objects as random objects location, can still be done. Have you used "Wblock" ? Yes need sample dwg.
-
Best habits and essential commands every CAD beginner should learn first?
BIGAL replied to shiva_10's topic in AutoCAD Beginners' Area
Welcome aboard, yes using a DWT a dwg with all your company settings in it like always used blocks, layers, linetypes and company layouts with correct title block at true size so use layouts from day one, won't look back using layouts. You don't have to have every block in your master dwg we had hundreds of little dwg's with a single block. Had a Blocks directory. I have a custom lisp that is loaded on startup and has stuff like reset osnaps for certain situations, plus some small often used lisp functions. I normally use 3 custom menu's with lots of commands in them, collected or coded by me over many years. Re insert block dwg. The obvious is ask questions here as someone may have already coded a program to speed up a task, your doing every day. Agree where are you in the world and what discipline. -
Got an AutoCAD Question? Bring It to Autodesk Answer Day on December 8
The AutoCAD Blog posted a topic in AutoCAD Blogs
What if the answer to the question you’ve been putting off was one post away? On Tuesday, December 8, 2026, Autodesk Answer Day returns to Autodesk Community, and AutoCAD specialists will be on the boards for about 24 hours. Whether you’re in the AEC industry or work in design and manufacturing, we’ve got you covered. Coverage follows the sun from Asia-Pacific to Europe, the Middle East, and Africa, and then to the Americas, so someone is there during your working day wherever you are. Come for a minute, an hour, or the whole day. How it works It’s easy. It’s free. It’s Autodesk Answer Day. Go to the AutoCAD forum that matches your question, select “Create a New Post,” and ask your question. A specialist will pick it up, answer in the open, and stay with the conversation until you have what you need. You can ask as many questions as you like, and every answer stays on the board, so the next person with the same question can find it too. You’ll be talking with Technical Support specialists and Community Managers, along with Expert Elites and other champions from the Community. Look for the Autodesk icon next to a name to spot an Autodesk employee. The Autodesk Expert Elite icon marks a Community member who isn’t an employee but knows the products very well. What to ask Anything you’re working on is a good question. Some places to start: Getting a hatch, block, or xref to behave the way you want Setting up layouts, viewports, and plotting Command aliases and shortcuts that fit how you draft Customizing your workspace and standards Getting installed, signed in, and licensed so you can start drafting A few details help us answer faster: your AutoCAD version, any error messages (a copied message or a screenshot both work), recent changes to your hardware, software, or drawing, and what you expected to see. Where to ask Specialists will be on these English boards: AutoCAD, AutoCAD LT, AutoCAD Architecture, AutoCAD Electrical, AutoCAD Map 3D, AutoCAD MEP, AutoCAD Mechanical, AutoCAD Plant 3D, AutoCAD for Mac, AutoCAD on mobile, and Raster Design. The Installation and Licensing board will be covered too. See the most up to date list of forums on the Community Central announcement post. AutoCAD boards in German, Japanese, and Korean will also have specialists on hand. Save the date, share it with your team, and bring your questions. The post Got an AutoCAD Question? Bring It to Autodesk Answer Day on December 8 appeared first on AutoCAD Blog. View the full article -
Every few years someone here asks how to get a real street map of a town into AutoCAD — see the 2010 threads “autocad maps” and “inserting os map download to drawings”. The answers back then were “buy a DXF” or “trace a raster”. Today OpenStreetMap covers most of the planet with vector data, so here is what actually works, from free to convenient. 1. QGIS (free). Install the QuickOSM plugin, draw your area, download highways / buildings / landuse, then Project → Import/Export → Export to DXF. You get a layer per OSM tag, but the DXF is in lat/lon or a UTM zone you must pick yourself, text labels are lost, and curves come in as dense polylines. 2. AutoCAD Map 3D / Civil 3D. MAPIMPORT reads SHP; take the SHP from Geofabrik extracts. Works well if you have Map 3D, but the extracts are whole countries and need clipping first. 3. Online converters. Full disclosure: I run one of them, osm2cdr.com (Russian UI at osm2cdr.ru). You pick an area on the map, choose DWG or DXF, and get a file with layers (roads by class, buildings, water, green, names as TEXT), already in a metric projection at 1:1 metres, so INSERT at 0,0 lands where you expect. There is a free preview. I am posting here because this question keeps coming back in the beginners’ area, and I would honestly like to hear what a DXF made from OSM must contain for you to use it in a real job: line types? blocks for POIs? paper space with a title block? Happy to answer questions about any of the three routes.
-
Adding to @Nikon excellent explanation of the ssget function, also include the option to filter out locked layers "_:L" else the routine would crash out. (setq ss (ssget "_:L" '((0 . "TEXT,MTEXT,DIMENSION,MULTILEADER"))))
-
To select multiple objects, use **`ssget`** instead of `entsel`, and then apply `setpropertyvalue` to each selected object in a loop. Select several objects using a frame, or one at a time. For all selected objects, the **Annotative** property will change to **No**. The filter allows you to select: `TEXT`, `MTEXT', `DIMENSION`, `MULTILEADER` **Objects are not deleted or recreated.** Only the `Annotative` property is changed. ; "Annotative" 0 /No/ (defun c:NoAnno (/ ss i) ; AI ;; (if (setq ss (ssget '((0 . "TEXT,MTEXT,DIMENSION,MULTILEADER")))) (if (setq ss (ssget "_:L" '((0 . "TEXT,MTEXT,DIMENSION,MULTILEADER")))) ; remark of Paul Li (progn (setq i 0) (repeat (sslength ss) (setpropertyvalue (ssname ss i) "Annotative" 0) (setq i (1+ i)) ) (princ (strcat "\nProcessed objects: " (itoa i))) ) ) (princ) ) ; "Annotative" 1 /Yes/ (defun c:YesAnno (/ ss i) ; AI ;; (if (setq ss (ssget '((0 . "TEXT,MTEXT,DIMENSION,MULTILEADER")))) (if (setq ss (ssget "_:L" '((0 . "TEXT,MTEXT,DIMENSION,MULTILEADER")))) ; remark of Paul Li (progn (setq i 0) (repeat (sslength ss) (setpropertyvalue (ssname ss i) "Annotative" 1) (setq i (1+ i)) ) (princ (strcat "\nProcessed objects: " (itoa i))) ) ) (princ) ) ;;; Remove/Add Annotative property to objects [No/Yes] (default No) ;;; Supported objects: TEXT, MTEXT, DIMENSION, MULTILEADER (defun c:SetAnno (/ ss i ans val) ;; Prompt the user, default is No (initget "No Yes") (setq ans (getkword "\nRemove/Add Annotative property to objects [No/Yes] <No>: ")) (if (not ans) (setq ans "No")) ; if Enter pressed — use No (setq val (if (= ans "Yes") 1 0)) ; Yes = 1, No = 0 ;; (if (setq ss (ssget '((0 . "TEXT,MTEXT,DIMENSION,MULTILEADER")))) (if (setq ss (ssget "_:L" '((0 . "TEXT,MTEXT,DIMENSION,MULTILEADER")))) ; remark of Paul Li (progn (setq i 0) (repeat (sslength ss) (setpropertyvalue (ssname ss i) "Annotative" val) (setq i (1+ i)) ) (princ (strcat "\nProcessed objects: " (itoa i) " | Annotative = " ans)) ) (princ "\nNo objects selected.") ) (princ) )
-
Szpl joined the community
-
Are you going to go around reviving old threads? One can certainly appreciate your providing answers, but some of these posts the OP is long gone. Perhaps it would be better to create a single new thread addressing these issues.
-
Maintaining coordinate integrity when combining survey drawings from different sources
SLW210 replied to indiancad's topic in AutoCAD Drawing Management & Output
I do very little of that sort of thing, but interestingly, I never ran into that issue as I recall. Speaking from experience though, I would make sure any survey data clearly had the coordinate system we use or I would send it back. That's why we paid them money. For my work we have local benchmarks. -
What was wrong with @alanjt's code in the link I posted?
-
That's most likely going to need a LISP or some other type of programming for "automatically". Can you post an example drawing?
-
Best habits and essential commands every CAD beginner should learn first?
SLW210 replied to shiva_10's topic in AutoCAD Beginners' Area
Welcome to CADTutor! I moved your thread to the AutoCAD Beginner's Area Forum. Some of those issues are discipline, company, and personnel preference specific in many instances. I use mostly default keyboard shortcuts, I used to have to show people AutoCAD on their computers and having mine customized was throwing me off. I use blocks a lot, most of the blocks are internally all on Layer 0 and ByLayer to take on the block layer's properties. One rule to never break IMO is nothing on Defpoints layer, if you need objects on a non-plotting layer, you can create them. A little background on why you are looking into drafting and which discipline(s) your are looking to work would help. -
John Verheul joined the community
-
Steven P started following Dialux to Autocad
-
... 6 1/2 years later to an OP who only ever asked one question, and never came back to see if anyone replied.
