Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/09/2023 in all areas

  1. Version 1.0.0

    1,858 downloads

    Hi, it's me again... I've searched my library of codes and run into Gian Paolo Cattaneo's AlignHatch routine, and guess what : I've founded that I've updated it into 4 variants : AlignH.lsp ; AlignHM (multiple) ; AlignB ; AlignBM (multiple) ... AlignB stands for Align Block... So I've decided to share all 4 as I think that they could be useful like Gian explained with his animated *.gif files... Anyway, since it's already public - I mean original version, I've redefined all 4 of them to work and in BricsCAD as BricsCAD don't have (c:cal) function... That's all from me for today... I just hope no one won't bother or be mad at me for posting this beautiful routines at download section... Original link : https://www.cadtutor.net/forum/topic/41902-alignh-align-hatch-on-curved-path Regards, M.R.
    1 point
  2. Perhaps... using a combination of the Drawing History feature, introduced in AutoCAD 2021, and Windows.
    1 point
  3. PP is my default name for testing. You should add an useful name. Also as I mentioned before, you should put at least SS in the parameters list (defun c:ListLenghts ( / ss) ..... )
    1 point
  4. That's exactly what my program does, and I have no problems with that part. The "difficult" part is to select the texts. In the simplest form, the program could ask the user to make the selection. A more complex program will search for the all the texts inside of a polyline selected by the user -that's what my program does. An even more complex program would ask just for the central text and it could find the surrounding polyline. I will see if I can get some time these days...
    1 point
  5. A idea make a list of the angle from pick text to all other outer text, (0.23 30.32)(1.57 45.23) sort the list so in angle order. Again can rearrange list so matches say the desired selected segment. Yes I know may fail on a shape like "U" and "L". Will have a play.
    1 point
  6. @fuccaro You can use point list by applying this sub to initial entity, just remember to put little bigger acc dividation factor... ;; Entity to Point List - M.R. ;; Returns a list of points describing or approximating the supplied entity, else nil if the entity is not supported. ;; ent - [ent] Entity name to be described by point list (POINT/LINE/ARC/CIRCLE/LWPOLYLINE/POLYLINE/ELLIPSE/SPLINE/HELIX) ;; acc - [num] Positive number determining the point density for non-linear objects (defun MR:ent->pts ( ent acc / der di1 di2 enx inc lst par fds fdm ) (vl-load-com) (setq enx (entget ent)) (cond ( (= "POINT" (cdr (assoc 0 enx))) (list (cdr (assoc 10 enx))) ) ( (= "LINE" (cdr (assoc 0 enx))) (list (cdr (assoc 10 enx)) (cdr (assoc 11 enx))) ) ( (wcmatch (cdr (assoc 0 enx)) "ARC,CIRCLE") (setq di1 0.0 di2 (vlax-curve-getdistatparam ent (vlax-curve-getendparam ent)) inc (/ di2 acc) di2 (- di2 1e-8) ) (while (< di1 di2) (setq lst (cons (vlax-curve-getpointatdist ent di1) lst) di1 (+ di1 inc) ) ) (reverse (if (vlax-curve-isclosed ent) lst (cons (vlax-curve-getendpoint ent) lst))) ) ( (and (wcmatch (cdr (assoc 0 enx)) "*POLYLINE") (zerop (logand 80 (cdr (assoc 70 enx))))) (setq par 0) (repeat (fix (+ 1.0 1e-8 (vlax-curve-getendparam ent))) (cond ( (not (setq der (vlax-curve-getsecondderiv ent par)))) ( (equal der '(0.0 0.0 0.0) 1e-8) (if (/= par (vlax-curve-getendparam ent)) (setq lst (cons (vlax-curve-getpointatparam ent par) lst)) ) ) ( (not (equal der '(0.0 0.0 0.0) 1e-8)) (if (/= par (vlax-curve-getendparam ent)) (progn (setq di1 (vlax-curve-getdistatparam ent par) di2 (vlax-curve-getdistatparam ent (1+ par)) ) (setq inc (/ (- di2 di1) acc) di2 (- di2 1e-8) ) (while (< di1 di2) (setq lst (cons (vlax-curve-getpointatdist ent di1) lst) di1 (+ di1 inc) ) ) ) ) ) ) (setq par (1+ par)) ) (reverse (if (vlax-curve-isclosed ent) lst (cons (vlax-curve-getendpoint ent) lst))) ) ( (wcmatch (cdr (assoc 0 enx)) "SPLINE,ELLIPSE,HELIX") (setq di1 (vlax-curve-getdistatparam ent (vlax-curve-getstartparam ent)) di2 (vlax-curve-getdistatparam ent (vlax-curve-getendparam ent)) inc (/ (- di2 di1) acc) di2 (- di2 1e-8) ) (while (< di1 di2) (setq fds (cons (distance '(0.0 0.0 0.0) (vlax-curve-getfirstderiv ent (vlax-curve-getparamatdist ent di1))) fds) di1 (+ di1 (distance '(0.0 0.0 0.0) (vlax-curve-getfirstderiv ent (vlax-curve-getparamatdist ent di1)))) ) ) (setq di1 (vlax-curve-getdistatparam ent (vlax-curve-getstartparam ent))) (setq fdm (apply (function max) fds)) (while (< di1 di2) (setq lst (cons (vlax-curve-getpointatdist ent di1) lst) di1 (+ di1 (* (/ (distance '(0.0 0.0 0.0) (vlax-curve-getfirstderiv ent (vlax-curve-getparamatdist ent di1))) fdm) inc)) ) ) (reverse (if (vlax-curve-isclosed ent) lst (cons (vlax-curve-getendpoint ent) lst))) ) ) ); end (MR:ent->pts ent acc)
    1 point
  7. Engineer_Yasser: I am happy to help! As Bigal pointed out, there are some limitations. You know, when I write programs I try something, then I get a better idea and change the program here and there... Reading the program again I would say that a (setq ss nil) is missing at the end of the program, for better memory management . I also wouldn't create vmin, since the value is only used once - I would put the expression (apply 'min txt1) on the next line, where vmin is used. Variables could be localized, the (princ...) line could be deleted - I only used it for debugging. But the most important limitation that comes to my mind is about selection: regardless if the initial polyline contains arcs or only lines, the program searches for texts inside another polyline that passes through the same vertices, but formed only by straight segments. In some cases, it might "forget" to select some texts. To explain better: see the following image. If the initial polyline is the blue one, the search area is the one in yellow. You can see that the text 201.3 is omitted. A quick fix: using CP instead of WP in the ssget line might improve the situation a bit. If all polyline segments are sure to have a matching text, the program could count the selected texts and warn the user if it doesn't match the number of vertices. That would be useful also if there are some stranger texts in the yellow area, outside the blue polyline. So Bigal and others: the program can be improved!
    1 point
  8. Using Lee-mac code depends on the direction of the pline is it Clockwise or anti clockwise. So easy to check.
    1 point
  9. Version 1.0.0

    981 downloads

    Hi, all It's me again... I'd like to share these 2 routines for linear tree branching... One is for picking start point and branching is performed all to the ends of all linear-curve entities and second one - you enter desired distance and branching is performed from start-picked point to desired lengths... All routines should operate on any type of linear-curve entities : POLYLINE(open), LWPOLYLINE(open), LINE, SPLINE(open), ELLIPSE(arc), ARC, HELIX... https://www.cadtutor.net/forum/topic/75840-trace-specify-length-on-pipe-network/?do=findComment&comment=600231 https://www.cadtutor.net/forum/topic/76008-auto-route-and-show-lenght-all-branch-of-tree-line/?do=findComment&comment=601097 That's all from me till now... Regards and take care, M.R.
    1 point
  10. Hi Guys, I Wanted To Mass Convert Some DWGs To DXFs, So, I looked Around and found some commercial softwares and also some lisp routine, but they didn't workout as i expected so i made a software (to interpret scripts). it works fine in converion of dxfs, so i thought this software might be usefull to some who want to mass convert dxfs, here is the software: AutoCAD Script Writer.zip This Software doesn't Require Installation, (It Runs Directly) ::REQUIREMENTS:: 1. AutoCAD which supports LISP routines (eG; full versions of AutoCAD 2010, But not AutoCAD LT Versions) ::Usage:: 1. In The "Location Of Files To Be Processed" Box, Paste The Location Where U have ur dwg files. (Default value is "D:\SomeFolder"). Dont Give A Root Location Such As "D:\" or "C:\" etc; 2. In The "Command" Box, The Default Code Is Written For DXF Conversion, U can modify and write ur own Macros here, (If U know Acad Scripting Language) 3. Pressing the "Create Script" Button will create a "Script.scr" file at the location of the dwg files 4. Now Open AutoCAD, Now Press [Control]+[N] In AutoCAD, A New Window will be opened 5. Now All U Have To Do Is Drag The "Script.scr", into the AutoCAD's Canvas (which is a blank black window usually) 6. And thats it, autocad will start converting the DWGs to DXFs Thanks To Lee-Mac, dbroada & Bill-Tillman for giving me the answer and idea to my previous post,
    1 point
×
×
  • Create New...