Jump to content

All Activity

This stream auto-updates

  1. Past hour
  2. This has been asked before for that task of dimensioning services in roads. I know did something pick base line then pick other lines and all done. Will try to find may have been a few years ago.
  3. BIGAL

    Batch DWG to PDF plot LISP File

    "Modelspace, paperspace or both?" looks like @Chicane_Apex has left the building, just like Elvis.
  4. BIGAL

    VS Code AutoCAD Lisp Snippets

    Another very useful is "Entmake functions.lsp", it has various entmake functions in it. Maybe make a word doc etc of your functions describing what they do. We had a "how to directory" with lots of help files. Was thinking about doing macros in Notepad++ run ents, run ss, ssl for layer, ssi for insert and so on. This is a common one. (repeat (setq x (sslength ss)) (setq obj (vlax-ename->vla-object (ssname ss (setq x (- x 1))))) ) Posted this before. Lisp files Apr 2024.docx
  5. Today
  6. Steven P

    VS Code AutoCAD Lisp Snippets

    I have some snippets saved away in different files - open, copy and paste as I need them. Others I have some files with many functions, such as text where I'll save the common functions and refer to them. For example a simple text selection (entsel, check it is text, message if not and reselect, return the text) or an entmod to update a text string... all in the same file but referenced by many functions in it. However I keep meaning to save away little functions to answer questions on the forum that get asked time and time again such as PDF plotting and batch LISPs
  7. CivilTechSource

    VS Code AutoCAD Lisp Snippets

    @BIGAL this is exactly what I want to achieve! I want to make it more accessible to people to learn how to write lisps. My plan is to start with basic functions, like getpoint and getdistance, if statements, prompts and so on. If you have suggestions on what more I can add please feel free.
  8. (defun c:foo (/ :paddvertex e lwp pts s) ;; Lee Mac's function (defun :paddvertex (e p / tan lm:lwvertices a b e h l n r w x z) (defun tan (x) (if (not (equal 0.0 (cos x) 1e-10)) (/ (sin x) (cos x)) ) ) (defun lm:lwvertices (e) (if (setq e (member (assoc 10 e) e)) (cons (list (assoc 10 e) (assoc 40 e) (assoc 41 e) (assoc 42 e)) (lm:lwvertices (cdr e))) ) ) (if (and p e (setq p (vlax-curve-getclosestpointto e (trans p 1 0)) n (vlax-curve-getparamatpoint e p) ) ) (if (not (equal n (fix n) 1e-8)) (progn (setq e (entget e) h (reverse (member (assoc 39 e) (reverse e))) l (lm:lwvertices e) z (assoc 210 e) ) (repeat (fix n) (setq a (cons (car l) a) l (cdr l) ) ) (setq x (car l) r (- n (fix n)) w (cdr (assoc 40 x)) w (+ w (* r (- (cdr (assoc 41 x)) w))) b (atan (cdr (assoc 42 x))) ) (entmod (append h (apply 'append (reverse a)) (list (assoc 10 x) (assoc 40 x) (cons 41 w) (cons 42 (tan (* r b)))) (list (cons 10 (trans p 0 (cdr z))) (cons 40 w) (assoc 41 x) (cons 42 (tan (* (- 1.0 r) b))) ) (apply 'append (cdr l)) (list z) ) ) ) ) ) ) ;; RJP » 2026-01-20 (cond ((setq s (ssget ":L" '((0 . "INSERT,LWPOLYLINE")))) (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))) (if (= "LWPOLYLINE" (cdr (assoc 0 (entget e)))) (setq lwp (cons e lwp)) (setq pts (cons (cdr (assoc 10 (entget e))) pts)) ) ) (and lwp pts (foreach e lwp (foreach pt pts (and (equal pt (vlax-curve-getclosestpointto e pt) 1e-4) (:paddvertex e pt)) ) ) ) ) ) (princ) )(defun c:foo (/ :paddvertex e lwp pts s) ;; Lee Mac's function (defun :paddvertex (e p / tan lm:lwvertices a b e h l n r w x z) (defun tan (x) (if (not (equal 0.0 (cos x) 1e-10)) (/ (sin x) (cos x)) ) ) (defun lm:lwvertices (e) (if (setq e (member (assoc 10 e) e)) (cons (list (assoc 10 e) (assoc 40 e) (assoc 41 e) (assoc 42 e)) (lm:lwvertices (cdr e))) ) ) (if (and p e (setq p (vlax-curve-getclosestpointto e (trans p 1 0)) n (vlax-curve-getparamatpoint e p) ) ) (if (not (equal n (fix n) 1e-8)) (progn (setq e (entget e) h (reverse (member (assoc 39 e) (reverse e))) l (lm:lwvertices e) z (assoc 210 e) ) (repeat (fix n) (setq a (cons (car l) a) l (cdr l) ) ) (setq x (car l) r (- n (fix n)) w (cdr (assoc 40 x)) w (+ w (* r (- (cdr (assoc 41 x)) w))) b (atan (cdr (assoc 42 x))) ) (entmod (append h (apply 'append (reverse a)) (list (assoc 10 x) (assoc 40 x) (cons 41 w) (cons 42 (tan (* r b)))) (list (cons 10 (trans p 0 (cdr z))) (cons 40 w) (assoc 41 x) (cons 42 (tan (* (- 1.0 r) b))) ) (apply 'append (cdr l)) (list z) ) ) ) ) ) ) ;; RJP » 2026-01-20 (cond ((setq s (ssget ":L" '((0 . "INSERT,LWPOLYLINE")))) (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))) (if (= "LWPOLYLINE" (cdr (assoc 0 (entget e)))) (setq lwp (cons e lwp)) (setq pts (cons (cdr (assoc 10 (entget e))) pts)) ) ) (and lwp pts (foreach e lwp (foreach pt pts (and (equal 0. (distance pt (vlax-curve-getclosestpointto e pt)) 1e-4) (:paddvertex e pt) ) ) ) ) ) ) (princ) )
  9. I Think they want this more for measurements of some type of conduit than for visual display. tho why not use lee mac's and just add whatever half or 3/4 of [SPLT] is. maybe points? you could get that from the block. @xenru need a little more detail on why you want this.
  10. Here you go sample.dwg
  11. Thank you for the suggestions and for taking the time to look into this. I appreciate your help and insights.
  12. @SCHNIPPLES please upload your-sample.dwg
  13. Best way to clean a difficult file is WBlock, not sure what had those bloated like that.
  14. What are the computer specifications? What OS? Lines, LWPolylines, 2DPolylines or 3D Polylines I doubt there is a permanent fix except to repair the drawings that have the issue, though it could still be an issue with your computer graphics. If it's polylines, try exploding them to lines, then PEDIT them back to LWPolylines, also try an Audit on the affected drawings. You could post an example drawing that has the issue, maybe it will show on other's computers if it's a .dwg issue.
  15. SLW210

    Batch DWG to PDF plot LISP File

    The OP is using AutoCAD LT 2026 and cannot use a .NET AFAIK. You are new so I removed your link to YouTube.
  16. lehoang6198

    Batch DWG to PDF plot LISP File

    Experience my plugin written with .NET API.
  17. marko_ribar

    Segments of polylines

    If you want to load lisp as it is, then you shouldn't localize that first (defun) along with other variables... Only if you push it (that first defun) in main body of command function (defun c:) you should localize it, wich is what I suggested... As you observed CAD won't recognize localized defun if it's out of main command function and bahave like global variable, though as if you had globals they should never be localized as they also won't be recognized...
  18. BIGAL

    VS Code AutoCAD Lisp Snippets

    @CivilTechSource Like you, It is a good idea to have a library of functions that you use all the time, in my Excel lisp there are 41 defuns so just copy and paste the ones I want to use, same with my Multi lisps for dcl's. often set them to write a dcl and then convert that file to dcl lisp code, like 3 lines of code to make a dcl. I have a VLAX lsp open all the time in my Notepad++ so again copy paste a function. I have a lot of lisp's saved as a function name eg Sort.lsp has various sort methods in it. I use windows "Findstr" a lot in a bat file so can look through an entire lisp directory for a keyword, identifies lisp files with that key word and copy and paste what I want out of existing code. You can in a lisp load an entire other lisp program and continue and use functions in that new lisp, I mention it as you could have little tiny lisp's like your "make layer.lsp" and just load when required. eg (if (not ah:butts)(load "Multi radio Buttons.lsp")) so you could have a few load lisp's at start of code saving lots of copying and pasting. Interested what others do.
  19. For me simplest and quickest is use a wipe out in the block, set to background then will auto obscure line underneath. Hopefully the result you want.
  20. karfung

    Create lisp for slab rebar

    @BIGAL Please share me. You can reach me at WhatsApp +60129736757
  21. Hi All, just wanted to thank everyone again for helping me so far in my lisp journey! As a token, I worked on a VS Code extension for AutoCAD snippets. This so it can allow users to type in quickly common functions the use all the time (e.g. search layer if dont exist create layer and so on). So far I have added the comment section. Happy to receive feedback and suggestions. Thank you https://marketplace.visualstudio.com/items?itemName=CivilTechSource.autocad-lisp-snippets
  22. Yesterday
  23. There is no problem in drawing that type of break it just involves a custom lisp to break the lines and draw wiggly lines, the amount of wiggle may have a couple of FUZZY values or scale factors. even a block just scaled to fit. To write your own lisp and its a good task to start learning, Draw a line say 1 unit long vertically one end at 0,0, the turn off snap and draw a wiggly Pline. Use list select pline and copy out the co-ords, to notepad You have 1/2 your code now, just make the points, use a scale factor on the Y value to adjust the points for the 2-3/8 then can draw the pline at correct position. Ok now the easy answer make a block and again draw a line, do the pline, erase the dummy line, save block. you can insert the block and scale it to suit the length required. insert block twice, after breaking line. I would turn second insert upside down so looks a bit more random. Ok I have avoided line work on any other angle than horizontal, on purpose, you can pick a point on 1st line break it, then perp to other line and auto break it also. This involves getting linework details like angle of lines. The actual pline could have randomness added to it so no 2 plines are quite the same by in example vertical, adjusting the x value within a range so 2 breaks don't touch. So have a go make a block and your homework is in lisp, Getpoint pt1, Polar for 2nd point, based on horizontal line, then Break using 2 points, getpoint again Pt2 using perp , break other side. Simple block answer.
  24. BIGAL

    Create lisp for slab rebar

    Yes is the answer to a lisp but it will cost you, but you will get much more than just what you have asked for as I have different lisps for Concrete slab design. More than is shown in this toolbar. Two solutions needed, it is not that hard to do a dimension using correct style turn off all the extensions etc and you will have a double arrow dimension, 1st step. Don't really need code. Pick 1st point then use perp for second point and over ride dimension with "A7" etc. Can do a mini defun in lisp if needed. You should be using a dwt "drawing template" for your work so the Dim style would be there already. Second step is a line with donuts at intersection, you use (SSGET "F" pts (list (cons 8 "REOBARLAYER")))) where pts is (list pt1 pt2) you can then draw a dummy line and use the vl Intersectwith method to find the intersecting points and draw donuts. That is your homework plenty of examples about SSGET and Intersectwith.
  25. Artem

    Segments of polylines

    Hi, first of all thanks a lot, i am only beginner in my LISP journey, and for me its hard to find good info in my native lang, so any usefull help is excelent. About UCS it worked fine, lw_orth now creates line in any UCS. (command "_,ucs" "_w") and (command "_.ucs" "_p") worked out! About regular_draw i tried to implement stuff you descriibed in post, but after that console says next: I setted SNAPUNIT to 1.0,1.0 as you said. Could you help me where am i wrong in adjusting regular_draw comand, it seems what i was looking for
  26. With LWT ON, lineweights visually change thickness when zooming in/out. Toggling LWT OFF → ON fixes the display temporarily, but the issue returns on the next zoom. Important: this does NOT happen with all files. Some DWGs display lineweights correctly, while specific files consistently show the issue. The problem appears in both Model and Layout. Plot/PDF output is always correct, so this seems to be a screen redraw / zoom rendering issue, possibly file-related. Tested with no success: LWT/LWDISPLAY, LINESMOOTHING=0, REGEN/REGENALL, Model vs Layout. Please, if anyone has encountered this behavior and found a permanent fix in AutoCAD for Mac 2022 (without resetting preferences or upgrading), I would really appreciate your help.
  27. ryanatkins49056

    Select all the lines that are vertical

    @Isaac26a One option you may want to consider outside of coding as well is an inbuilt AutoCAD command called QSELECT. You can select what's on the screen. The in the dialog box that appears play with all the filters available. For example select all lines the are equal to 90degrees.
  28. Found this little gem, I guess perpetual license means F - Off, buy our subscription
  1. Load more activity
×
×
  • Create New...