All Activity
- Past hour
-
pkenewell started following Return text from wcmatch
-
I've already helped, you obviously didn't read my post first. I finally posted the code. Even though I work too, I found the time to do it. Happy Epiphany Day
-
What they're talking about, I believe, is a matter of fairness. You ask for help but provide none in return. Most of us have other commitments, but we make time to teach and to help others. Not only that, learning a bit about AutoLISP will make your work easier and faster.
- Today
-
I'll this topic a "wrap" Thanks to all here! rlx: I also have worked at my last company of fifteen years within a very locked down IT environment. Here and now, I am free! One caveat here is that there are limitations in acquiring additional Microsoft tools i.e., Power Platform tools, etc. due to the complexity introduced from being a client of an widely known commercial web hosting service. Happy, happy, happy! Clint
-
Okay
-
Viewport Inset Generator
CivilTechSource replied to CivilTechSource's topic in AutoLISP, Visual LISP & DCL
@tombu Yes Lee Code is perfect, if you want to stop there. But I would like to take it a step further. @BIGAL This is a different approach that might just work perfectly! -
Perform an OUTSIDE offset for several rectangles
Nikon replied to Nikon's topic in AutoLISP, Visual LISP & DCL
Now we are talking not only about rectangles, but also polygons from LWPOLYLINE, POLYLINE. The problem is that the polygons from the LWPOLYLINE, POLYLINE must be closed. Lee Mac's OffInside.lsp code also allows offsets for CIRCLE, ARC, ELLIPSE, and SPLINE. -
Saxlle started following Perform an OUTSIDE offset for several rectangles
-
Perform an OUTSIDE offset for several rectangles
Saxlle replied to Nikon's topic in AutoLISP, Visual LISP & DCL
Anything can be done, but it would be helpful if you could post an example drawing so we can see those rectangles. You can use Lee's code to perform that making a two solutions, one for inside (as it is in the example from Lee's post, and one to performe outside offset as Lee suggested). -
Perform an OUTSIDE offset for several rectangles
Nikon replied to Nikon's topic in AutoLISP, Visual LISP & DCL
@Lee Mac thank you, that's great! Is it possible to add a check for closing polylines to the code, and if they are not closed, close them? Is it possible to combine the two codes: OffInside.lsp и CloseLwPl.lsp? (defun c:CloseLwPl (/ ss i ent edata elist obj) (prompt "Select LWPOLYLINE: ") (setq ss (ssget '((0 . "LWPOLYLINE")))) (if ss (progn (setq i 0) (repeat (sslength ss) (setq ent (ssname ss i)) (setq edata (entget ent)) (setq elist (assoc 70 edata)) (if (not (and elist (= (logand (cdr elist) 1) 1))) (progn (entmod (subst (cons 70 (logior (cdr elist) 1)) elist edata)) (entupd ent) ) ) (setq i (1+ i)) ) ) ) (princ) ) -
Cucu Setiawan joined the community
-
shirleydaf joined the community
-
o.oclilac joined the community
-
Their IT department even has a slogan (and I'm not kidding here) : You name it , we block it
-
Yikes! Working with your arms tied.. No way I could work effectively without my tools, I would at least need autohotkey. Last company I worked for, I automated their whole system, mostly because I was lazy and I wanted to eat donuts all day. AutoCAD ships with .NET, nothing to install, I would be rolling some goodies for sure. “We At ACME corporation stifle innovation by making everyone think inside the box”
- Yesterday
-
Even if I wanted to use a different language I wouldn't be able because at my work I'm unable to install any software that's not supplied in our software center , also certain extensions like *.bat are a big freaking no no so my dragon claws are tied in that respect. But I can get vl-some satisfaction however whenever I can create something that at first glance seems impossible to do and then come up with something that actually works.
-
What programming language to use ? There are so many, Lisp, Pascal, VBA, C##, now .NET, Python and of course the push product by Autodesk Dynamo but only on certain platforms. Yeah the macro record almost useless. As I have said before years ago macro record in a CAD program wrote VBA code. There is lisp2C from years ago that converted lisp code to C## code, hey Daniel what about convert lisp to Python ? The main advantage in lisp is the non compile, just run, I use code that is 30+ years old still works. Any compiled code every few years has to be recompiled to work as versions change. Dont forget how many years ago now Autodesk said VBA support would be removed, it's still there.
-
Lee Mac started following Perform an OUTSIDE offset for several rectangles
-
Perform an OUTSIDE offset for several rectangles
Lee Mac replied to Nikon's topic in AutoLISP, Visual LISP & DCL
Use this and simply switch: *dist* (- *dist*) To: (- *dist*) *dist* -
Perform an OUTSIDE offset for several rectangles
BIGAL replied to Nikon's topic in AutoLISP, Visual LISP & DCL
A couple of answers, as suggested, check is closed pline ie a rectang drawn CW or CCW then vla-offset will always go out for a CCW pline. You can do a check and reverse the pline if required. Or the simpler is (setq offsetpt (getvar 'extmax)) -
It’s more of, ‘pick the right tool for the right job’. In this case, ObjectARX, and by extension, Python, can provide a clean new drawing to import your DXFs into every time, whereas lisp may not. I don’t remember what all is stored in DXF, i.e. if there are things that are non-purgeable. An example is an existing text, dimension, or table style, that are named “Standard”. Nested references, Associated Styles (the text style for a dimension style). There may be user variables stored per drawing CLAYER, LTSCALE: So, using lisp DXFIN -> purge -> save on repeat may have subtle side effects. This may or may not be an issue for you
-
For most things I do this is my default option, rarely need to do much other than that and if I do, drag and drop.
-
Steven P started following Perform an OUTSIDE offset for several rectangles
-
Perform an OUTSIDE offset for several rectangles
Steven P replied to Nikon's topic in AutoLISP, Visual LISP & DCL
I would maybe use: (vla-Offset (vlax-ename->vla-object ent) dist) where dist can be positive to go one direction, negative to go the other. This direction might also depend on the direction that the rectangle was drawn - clockwise or anticlockwise. Could do them both directions and just delete the shorter line - a few more lines of code to add though, some thinking for the first full week of work in 2026, always a quiet week. I might also suggest a couple more filters to the selection set, if all rectangles are closed polylines (test: 70 is 1 or 128 - use bitand (search for this Lee Mac uses this often to test both at the same time)), or number of vertices being 3 (closed polyline) or 4 (open polyline) (test: 90 is 3 or 4) -
Perform an OUTSIDE offset for several rectangles
Nikon posted a topic in AutoLISP, Visual LISP & DCL
Good day everyone! *** Happy New Year 2026! *** I wish you good health and creative success! I'm asking for help in changing the code. I want to select several rectangles and execute the command "Offset" OUTWARD by a specified distance. But the command performs an inward Offset. thanks (defun c:RectOffBatch (/ selset dist i ent pts maxpt offsetpt) (prompt "\nSelect rectangles (polylines): ") (setq selset (ssget '((0 . "LWPOLYLINE")))) (if selset (progn (initget 7) (setq dist (getdist "\nEnter the offset distance: ")) (setq i 0) (repeat (sslength selset) (setq ent (ssname selset i)) (setq pts (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget ent)))) (setq maxpt (list (apply 'max (mapcar 'car pts)) (apply 'max (mapcar 'cadr pts)))) (setq offsetpt (list (+ (car maxpt) dist) (+ (cadr maxpt) dist))) (command "_.OFFSET" dist ent offsetpt "") (setq i (1+ i)) ) ) ) (princ) ) -
Hi Danielm 103, Yes, Python is a distinct possibility. Has Python-based programs replaced LISP-based programming in your current experience. Why or why not? Thanks, Clint
-
Hi rlx, The Excel-based automated gem you coded would have certainly minimized the extremely mundane diagram-based tasks and would have been handy in what is one half (15 years) of my overall drafting design career sentence within the chemical processing industry * using mainly AutoCAD, other Autodesk-based products, plus a few of the last years there in BricsCAD. I appreciate your explanation on the program's purpose and your particular career experience. I find it very interesting how functionality changed in BricsCAD between your V22 used and the BricsCAD V25 used that caused the lack of an expected file conversion outcome. I am slowly weaning myself off the AI crutch that can never replace real personal experience and direct application from learning programming languages. Thanks, Clint Footnote (*) My interests now lie in CAD programming that I wish I had started years ago as I am now working in the pre-engineered metal building design/manufacturing position that is much more in line with my formal education, personal interest, and work in mechanical and structural design departments that make up half of my 30+ years of design drafting experience.
-
Hi BIGAL, Of course, an elegantly simple and effective solution is presented here. This nugget is being stored and will come in handy for related batch scripting. Thanks, Clint
-
The promised update The version above works but with one exception: It only places the converted (DWG) files in the source (DXF) file folder according to the code, of course. It works for me. Thanks, Clint
-
Hi troggarf, We use BricsCAD. I thank you, sir! Clint
-
The reason I clean the drawing is I once wrote a program to generate instrument loop diagrams from an excel file. I found the most stable and easy way was not to use a script but stay in the current drawing and from there save(as) each loop. I also made use from templates and also had the option to update the drawing in stead of generating the entire drawing. But at some time some templates had been given an update to a block definition and to be certain the latest version was used I had to make sure the old block was purged. Overkill , some times yes , but in my case it worked as it should. In this case , dxfin , probably overkill , but it doesn't hurt either. I tested it on Bricad 22 and the dwg extension was no problem, it worked as it should. The recommendation from the annoying paperclip oh , sorry , AI its called these days , to pimp the filename and use vla-saveas is not wrong though. Just didn't need it on my computer. Had it gave me an error I would have fixed it but it worked right from the start for me.
-
According to the ARX docs using dxfIn While rlx’s version attempts to clean the drawing via vla-purgeall, I suppose there could be some items that are not purged? It’s not clear what happens in case of an existing dictionary or style. AI “AutoCAD typically handles conflicts by prioritizing the current drawing's definitions” I'm guessing that rlx’s version is safe enough though
