All Activity
- Today
-
Steven P started following Applications on top , Create 3 Center Curves for Polylines , Lisp request... trim (wall) lines with (column) multiple closed plines and circles and 1 other
-
Create 3 Center Curves for Polylines
Steven P replied to broncos15's topic in AutoLISP, Visual LISP & DCL
Just for fun, a slight different way to set variables, I like the dotted pair listing to tie in variable name and its short description. Could be expanded as basic lists with the last item being the 'get' function (string, int, distance....) for different types using read and eval [ (list "ard" "Approach Radius" "getDist") ] (defun c:setvariables ( / acount ard crd erd aof eof ) (setq VariablesList (list (cons "ard" "Approach Radius") (cons "crd" "Center Radius") (cons "erd" "End Radius") (cons "aof" "Approach Offset") (cons "eof" "Tie In Offet") )) ; end list, end setq (foreach n VariablesList (setq MyX (getDist (strcat "\nSet " (cdr n) ": "))) (eval (read (strcat "(setq " (car n) " " (vl-princ-to-string MyX) ")" ))) ) ; end foreach ) (defun c:setvariables ( / acount ard crd erd aof eof ) (setq VariablesList (list (list "ard" "Approach Radius" "getdist") (list "crd" "Center Radius" "getdist") (list "erd" "End Radius" "getdist") (list "aof" "Approach Offset" "getdist") (list "eof" "Tie In Offet" "getdist") )) ; end list, end setq (foreach n VariablesList (setq MyX ( (eval (read (last n))) (strcat "\nSet " (cadr n) ": "))) (eval (read (strcat "(setq " (car n) " " (vl-princ-to-string MyX) ")" ))) (if (= (last n) "getstring") ; fix for strings (eval (read (strcat "(setq " (car n) " \"" (vl-princ-to-string MyX) "\")" ))) ) ) ; end foreach ) Couple of edits for typos -
Create 3 Center Curves for Polylines
SLW210 replied to broncos15's topic in AutoLISP, Visual LISP & DCL
You could just modify the LISP to store the last inputs. -
Does very well on some examples, but fails on a couple. From OPs original drawing (this one has given me problems as well) and a few shapes I made it didn't close the centerline.
-
Lisp request... trim (wall) lines with (column) multiple closed plines and circles
Steven P replied to ilarch2016's topic in AutoLISP, Visual LISP & DCL
For future reference and to follow on from SLW210, I'd perhaps only share the relevant information - seeing your drawing has a lot of layouts with borders, company information and so on, all good but maybe not always the best policy to share publicly. Purged, overkilled and so on to remove any company information that might be hidden too -
Lisp request... trim (wall) lines with (column) multiple closed plines and circles
SLW210 replied to ilarch2016's topic in AutoLISP, Visual LISP & DCL
The LISP worked on your original drawing, after I flattened it. You have issues with that drawing. You need to set the Current Layer to the one you want. -
Lisp for to get y value of polyline based on datum value and line.
Steven P replied to Ish's topic in AutoLISP, Visual LISP & DCL
For my long sections I tend to create a block for the long section itself and then scale the X and Y axis to whatever scales I want ( I tend to use a Y scale of 5x, and X at 1x ) - that makes the analysis easier This is what I use. Select the surface profile Select the route / Datum line (I use this to measure the designed buried depths for new services) Loop to select the distance marker / indicator and then its associated text to update If I was doing this I would copy your vertical lines and associated texts to the points you want. Extend or trim these lines to the surface polyline then run this LISP to complete the texts. Can be a bit long to do a really long long section but I don't do so many of these to make the coding worth selecting everything all at once... so for now select all one at a time (defun c:LSBuriedDepth ( / ) (defun LM:intersections ( ob1 ob2 mod / lst rtn ) ; Lee Mac (if (and (vlax-method-applicable-p ob1 'intersectwith) (vlax-method-applicable-p ob2 'intersectwith) (setq lst (vlax-invoke ob1 'intersectwith ob2 mod)) ) ; end and (repeat (/ (length lst) 3) (setq rtn (cons (list (car lst) (cadr lst) (caddr lst)) rtn) lst (cdddr lst) ) ; end setq ) ; end repeat ) ; end if (reverse rtn) ) ; end defun (defun inter ( Ent1 Ent2 / obj1 obj2 ) ;Lee Mac (setq obj1 Ent1) (setq obj2 Ent2) (foreach pnt (LM:intersections (vlax-ename->vla-object obj1) (vlax-ename->vla-object obj2) acextendOTHERENTITY) (setq pt pnt) ) ; end foreach pt ) ; end defun (defun LStext ( n / EndLst ent entlst) ;updates text to 'n' (setq EndLst "No") (while (= EndLst "No") ;;loop till enter or space (progn (setvar 'errno 0) (setq ent (car (nentsel (strcat "\nSelect text to change")))) (cond ( (= 7 (getvar 'errno)) ;a (princ "\nMissed, try again.") ) ;end cond a ( (and (/= (cdr (assoc 0 (entget ent))) "TEXT")(/= (cdr (assoc 0 (entget ent))) "MTEXT") ) (princ "\nMissed, try again") ) ( ;'t' (setq entlst (entget ent)) (setq entlst (subst (cons 1 n) (assoc 1 entlst) entlst)) (entmod entlst) (entupd ent) (setq EndLst "Yes") ) ;end cond b ) ;end Cond ) ;end progn ) ;end while (princ) ) ; end defun ;;End subfunctions (setq Ent1 (car (nentsel "\nSelect Surface Line (explode Blocks)"))) (setq Ent2 (car (nentsel "\nSelect Route or Datum Line (explode Blocks)"))) (while (setq Ent3 (car (entsel "\nSelect Distance Marker"))) ;; (setq Int1 (inter Ent1 Ent3)) ;; (setq Int2 (inter Ent2 Ent3)) (setq MyDist (- (cadr (inter Ent1 Ent3)) (cadr (inter Ent2 Ent3)))) ; Adjust here MyDist to acount for any scaling factors (setq MyDist (rtos MyDist 2 3)) (LStext (vl-princ-to-string MyDist)) ) ; end while )- 16 replies
-
that would be a windows thing rather than a CAD (or any other application) thing. Best I can think off would be to resize the windows so both are shown that way. Problem with doing it via lisp is whatever you are using to display the text would be closed or hidden as you do a CAD command, though perhaps a custom tool bar might work which just shows the text
-
Hi, I have a feeling this question has never been asked here. I have a Lisp that reads the drawing, writes a text file and opens it with Notepad. But I would like to be able to work with AutoCAD while keeping the contents of the file visible. Is there any Lisp that can do this?
-
hly joined the community
-
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
Definitely, there will be bunch of overlapping texts. But, I think the problem is in the "grid", the equidistants are not equal and elevations can't be obtained. As I mentioned: I'm not familiar with working in Civil 3D, so I can't help here further.- 16 replies
-
Looking for a LISP to evenly space polylines from their end points
Saxlle replied to Tamim's topic in AutoLISP, Visual LISP & DCL
Hey @Tamim, Glad it works for the "based concept". But, I can't figure out "Option 1" and "Option 2", it's really messy to understand what I need to accomplish (because there is a bunch of overlapping polylines).If you can provide a clear, detailed, explanation, I will try to fix the code so that it works for "Y" direction movements as well. Best regards. -
Looking for a LISP to evenly space polylines from their end points
Saxlle replied to Tamim's topic in AutoLISP, Visual LISP & DCL
Hey @BIGAL, I used a "base point" to avoid determinanting is the polyline drawn CCW or CW, easier, and then calculated new position of the polylines based on choosing "Left or Right", which means the "X" coord will change in that side. Also, I supose that the polyline can have many vertexes and drawed randomly (not only straight lines). Bassicly, this is the one of the concept how it can be done. I figured out the easiest way is sorting by the Lengths of the polyline, from min to max, to get a proper order. Can't wait to see your solution, maybe find something interesting inside the code . -
Lisp request... trim (wall) lines with (column) multiple closed plines and circles
ilarch2016 replied to ilarch2016's topic in AutoLISP, Visual LISP & DCL
I wish the result could be keeping green lines in the original layer, and remove the overlaping -
Looking for a LISP to evenly space polylines from their end points
Tamim replied to Tamim's topic in AutoLISP, Visual LISP & DCL
@Saxlle Thanks for the code. It’s working based on the concept. Please check the DWG file. I’ve worked on Option 1 and Option 2. In Option 1, I planned the left-side spacing as per your video input, all settings are done, but the output line looks different. Please advise on this. Option 2 is another concept where the top side moves up and down, similar to the left and right adjustments line shifting.dwg -
- Yesterday
-
Looking for a LISP to evenly space polylines from their end points
BIGAL replied to Tamim's topic in AutoLISP, Visual LISP & DCL
Hi @Saxlle started to do something found the plines are drawn in a CCW or CW direction for left right so I am going to set that to one direction I look at the length of 1st and 3rd section to work out which end to change, so no need for Left or right. The start point is (/ offset 2) left or right. So don't need user enter base_point. I just worked out the new X values for the pline and use (vlax-put obj 'coordinates pts) to redo the pline no need to actually draw a new pline. use (vlax-get obj 'coordinates) for the XY values of the pline. Yes need a ssget but looking at a drag over the plines for offset order. So yes would do twice for sample. NOTE my code is based on the sample dwg provided, got about 1/2 way when posting this, hopefully later today will post my attempt. -
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
If your trying to get the levels shown by the Brown lines color 11 you will end up with a mess of overlapping text. In this image looks like a road etc so want levels. Civ3D at times lacks some functionality, it looks like you have used a built in grid option for plotting long section etc. You may be better off going back to your CAD dealer and ask for help about how to set up CIV3D to meet your needs. I know in other add on software can use different methods to set what points get levels plotted, A lot of times the complexity of using CIV3D is a problem and finding the solution is difficult. Maybe post this question into the CIV3D forum. I stopped using CIV3D many years ago so can not help.- 16 replies
-
The issue wasn't retention of the stacking. In version 5.0c at least the height checkbox didn't remove the text overide whilst the copy of 5.0d I found did.
-
mhupp started following Create 3 Center Curves for Polylines
-
Create 3 Center Curves for Polylines
mhupp replied to broncos15's topic in AutoLISP, Visual LISP & DCL
replace ;;----------------------------------------------------------------------;; (vl-every '(lambda ( sym msg ) (initget 6) (set sym (getdist msg))) '(ard crd erd aof eof) '("\nSpecify approach radius: " "\nSpecify center radius: " "\nSpecify end radius: " "\nSpecify approach offset: " "\nSpecify tie-in offset: " ) ) ;;----------------------------------------------------------------------;; with ;;----------------------------------------------------------------------;; (setq crd (getdist "\nMiddle Radius: ") ard (* 2 crd) ; Approach radius erd (* 3 crd) ; Exit radius aof (* 0.0375 crd) ; Approach offset eof (* 0.1236 crd) ; Exit offset ) ;;----------------------------------------------------------------------;; Tho that is pretty cool way to set a bunch of variables with lambda -
Impossible to change attribute text size within dynamic block
jamami replied to jamami's topic in AutoCAD Drawing Management & Output
Thank you For the suggestion. I believe the only solution to solve this is Lisp or similar . i need to change the text height without exploding the dynamic and sub blocks. the reason for this is that this beam block does not work alone . There are several other blocks that work alongside it . All attributed in a similar way . i need the ability to control the text height via the text style name and the only way to do this is via an intrusive script . -
Lisp request... trim (wall) lines with (column) multiple closed plines and circles
ilarch2016 replied to ilarch2016's topic in AutoLISP, Visual LISP & DCL
I give it a try. this is what I got.This routine goes wrong with overlapping. and change the layer(green to yellow) lisp request_tics result.dwg -
Steven P started following UnFormat - Lee Mac and Impossible to change attribute text size within dynamic block
-
Impossible to change attribute text size within dynamic block
Steven P replied to jamami's topic in AutoCAD Drawing Management & Output
one work around might take some work, might work If you are happy with the text sizes being incremental se up your attributed dynamic block as you have now. Set these as a visibility status, lets say called "1-1" Add fields positioned as you like and suitably sized to be larger or smaller text, set their visibility status, lets say"2-1" or "1-2" - larger or smaller as you want. Each attribute will be linked to a field - change the attribute the field text also changes. When you insert the block and set a status then only the attribute or field should show which should be the size you want. I say should.. I haven't tried this -
annotative text style Help me create a annotative dimension style and text style style
Steven P replied to sachindkini's topic in AutoLISP, Visual LISP & DCL
Coming back to this one: Annotative Text, I find that I have to create the text style and then add the extended data to convert it to annotative text Handy that this can have an if loop in it and be used to create either normal or annotative if you want to adjust it: (defun c:MakeAnnoFont ( FontName FontStyle / Height NewFontEnt exdata newent ) (setq Height 0) (setq NewFontEnt (entmakex (list '(0 . "STYLE") '(100 . "AcDbSymbolTableRecord") '(100 . "AcDbTextStyleTableRecord") (cons 2 FontName) '(70 . 0) (cons 40 Height) '(41 . 1.0) '(50 . 0.0) '(71 . 0) (cons 42 Height) (cons 3 FontStyle) ;; Font style to include suffix e.g. '.ttf' or '.shx' '(4 . "") ))) ; end entmakex, end list, end setq ;;Add xdata - annotative text (regapp "AcadAnnotative") (setq exdata '((-3 ("AcadAnnotative" (1000 . "AnnotativeData") (1002 . "{") (1070 . 1) (1070 . 1) (1002 . "}") ) ; new extended data— )) ) (setq newent (append (entget NewFontEnt) exdata)) ; Appends new data list to entity's list. (entmod newent) ; Modifies the entity with the new definition data. (princ) ) I don't use a lot of annotative dimensions to make a LISP worthwhile, but reading this week I think the method is the same, create the dimension and then add the xdata to it afterwards. Most of my dimension LISPs started off from here: https://stackoverflow.com/questions/47835301/use-autolisp-to-generate-new-dimension-style Though from BigAl, I think this one sets all the dimension stuff ; https://www.cadtutor.net/forum/topic/56889-entmake-for-dimension-styles/ ; BigAl ; DimStyle Create ; (defun DSTYLE_DIMSTYLE_CREATE (DSTY$ DSCL# AH$ FSTY$) (if (null (tblsearch "dimstyle" DSTY$)) (progn (entmakex (list (cons 0 "DIMSTYLE") ; Entity Type (cons 100 "AcDbSymbolTableRecord") ; Subclass marker (cons 100 "AcDbDimStyleTableRecord") ; Subclass marker (cons 2 DSTY$) ; Dimstyle name (cons 70 0) ; Standard flag value (cons 3 "") ; DIMPOST (cons 4 "") ; DIMAPOST (cons 5 AH$) ; DIMBLK (cons 6 AH$) ; DIMBLK1 (cons 7 AH$) ; DIMBLK2 (cons 40 DSCL#) ; DIMSCALE (cons 41 0.0937) ; DIMASZ (cons 42 0.0937) ; DIMEXO (cons 43 0.38) ; DIMDLI (cons 44 0.0625) ; DIMEXE (cons 45 0.0) ; DIMRND (cons 46 0.0625) ; DIMDLE (cons 47 0.0) ; DIMTP (cons 48 0.0) ; DIMTM (cons 140 0.0937) ; DIMTXT (cons 141 0.09) ; DIMCEN (cons 142 0.0) ; DIMTSZ (cons 143 25.4) ; DIMALTF (cons 144 1.0) ; DIMLFAC (cons 145 0.0) ; DIMTVP (cons 146 1.0) ; DIMTFAC (cons 147 0.0625) ; DIMGAP (cons 71 0) ; DIMTOL (cons 72 0) ; DIMLIM (cons 73 0) ; DIMTIH (cons 74 0) ; DIMTOH (cons 75 0) ; DIMSE1 (cons 76 0) ; DIMSE2 (cons 77 0) ; DIMTAD (cons 78 3) ; DIMZIM (cons 170 0) ; DIMALT (cons 171 2) ; DIMALTD (cons 172 0) ; DIMTOFL (cons 173 0) ; DIMSAH (cons 174 0) ; DIMTIX (cons 175 0) ; DIMSOXD (cons 176 1) ; DIMCLRD (cons 177 1) ; DIMCLRE (cons 178 2) ; DIMCRRT (cons 270 4) ; DIMUNIT (cons 271 4) ; DIMDEC (cons 272 4) ; DIMTDEC (cons 273 2) ; DIMALTU (cons 274 2) ; DIMALTTD (cons 275 0) ; DIMAUNIT (cons 276 2) ; DIMFRAC (cons 277 4) ; DIMLUNIT (cons 279 2) ; DIMTMOVE (cons 280 0) ; DIMJUST (cons 281 0) ; DIMSD1 (cons 282 0) ; DIMSD2 (cons 283 1) ; DIMTOLJ (cons 284 0) ; DIMTZIN (cons 285 0) ; DIMALTZ (cons 286 0) ; DIMALTTZ (cons 287 5) ; DIMFIT (cons 288 0) ; DIMUPT (cons 340 (tblobjname "style" FSTY$)) ; DIMTXSTY (cons 342 (cdr (assoc 330 (entget (tblobjname "block" AH$))))); DIMLDRBLK (cons 343 (cdr (assoc 330 (entget (tblobjname "block" AH$))))); DIMLDRBLK1 (cons 344 (cdr (assoc 330 (entget (tblobjname "block" AH$))))); DIMLDRBLK2 ) ) ) ) And I'll give you 'Jeff' which has a better description of the one above Jeff just adjusts dimension font style, text height, and colours. Arrows are set at 2x font height I think - from the stackoverflow link above (defun c:jeff ( / DimStyleName DSN FontStyleName FSN FontHeight TxtCol LinCol Col TxtPrecision TxtPrec) ;;change dimension style ;;Dimension Style (princ "\nEnter Dimension style Name ")(princ (tableSearch "dimstyle")) (setq DimStyleName (getvar "dimstyle")) (setq DSN (getstring (strcat ": (" DimStyleName "): ") t)) (if (or (= DSN nil)(= DSN "")) (setq DimStyleName DimStyleName) (setq DimStyleName DSN) ) (princ DimStyleName) ;;Font Style (princ "\nEnter Font style Name ")(princ (tableSearch "style")) ;; (setq FontStyleName (nth 0 (tableSearch "style"))) (setq FontStyleName (getvar "textstyle")) (setq FSN (getstring (strcat " (" FontStyleName "): ") t)) (if (or (= FSN nil)(= FSN "")) (setq FontStyleName FontStyleName) (setq FontStyleName FSN) ) (princ FontStyleName) ;;Font Height (setq FontHeight 2.5) ;; How to get this from dimstyle selected above (setq FontHght (getreal (strcat "\nEnter Font Height [" (rtos FontHeight)"]: "))) (if (or (= FontHght nil)(= FontHght "")) (setq FontHeight FontHeight) (setq FontHeight FontHght) ) (princ FontHeight) ;;Colours (setq TxtCol 0) ;Text. 0: By Layer, 256: ByBlock (setq Col (getint (strcat "\nEnter Text Colour Code (0: ByLayer, 256: ByBock) [" (rtos TxtCol)"]: "))) (if (or (= Col nil)(= Col "")) (setq TxtCol TxtCol) (setq TxtCol Col) ) (princ TxtCol) (setq LinCol 0) ;Lines. 0: By Layer, 256: ByBlock (setq Col (getint (strcat "\nEnter Lines Colour Code (0: ByLayer, 256: ByBock) [" (rtos LinCol)"]: "))) (if (or (= Col nil)(= Col "")) (setq LinCol LinCol) (setq LinCol Col) ) (princ LinCol) ;;Precision (setq TxtPrecision 4) ; number of decimal places ;; How to get this from dimstyle selected above (setq TxtPrec (getint (strcat "\nEnter Decimal Places) [" (rtos TxtPrecision) "]: "))) (if (or (= TxtPrec nil)(= TxtPrec "")) (setq TxtPrecision TxtPrecision) (setq TxtPrecision TxtPrec) ) (princ TxtPrecision)(princ " DP") (setq DimensionScale (/ FontHeight 2.5)) (jeff1 DimStyleName FontStyleName FontHeight TxtCol LinCol TxtPrecision DimensionScale) (princ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defun jeff1 ( DimStyleName FontName FontHeight TxtCol LinCol TxtPrecision DimensionScale / ) ;;Sub Routines (defun mytextstyle ( myfont / mytextstyle fontcount fontlist) ;;check textstyle is loaded ;;Font Style Lists ;;Fontname Height WidthFactor ObliqueAngle Backwards UpsideDown (setq fontstyles (list (list "Standard" "Arial" "0.0000" "1.0000" "0" "No" "No") (list "romans" "romans.shx" "0.0000" "1.0000" "0" "No" "No") ;;Add your own font definitions here ));end fontstyles list (if (member myfont (tableSearch "style")) (princ "Font Is Loaded") (progn ; Font isn't loaded (setq fontcount 0) (while (< fontcount (length fontstyles)) (if (= (strcase (nth 0 (nth fontcount fontstyles))) (strcase myfont)) (progn ;font style is loaded (setq fontlist fontcount) ;;font style exists ) ; end progn ) ;end if (setq fontcount (+ 1 fontcount)) ) (if (= fontlist nil) (progn ;;if font is not defined above or loaded (alert "Font style needs loading. Please edit it") (command "Style" myfont "romans.shx" "0.0000" "1.0000" "0" "No" "No" "No") (initdia) (command "style") ) ;end progn (progn (command "style" (nth 0 (nth fontlist fontstyles)) (nth 1 (nth fontlist fontstyles)) (nth 2 (nth fontlist fontstyles)) (nth 3 (nth fontlist fontstyles)) (nth 4 (nth fontlist fontstyles)) (nth 5 (nth fontlist fontstyles)) (nth 6 (nth fontlist fontstyles)) (nth 7 (nth fontlist fontstyles)) ) ;end command ) ;end progn ) ;end if ) ;end progn );end if (setq mystyle myfont) ;;text font style.. if anything else check if style is loaded into drawing here mystyle ) ;;End Sub Routines (mytextstyle FontName) ;; Check Font exists else make it ;;Full list of dimension variables. ;;Change all or none as required, save and existing style to update ;;NOTE: BYBLOCK and other texts to be numbers? ;;https://help.autodesk.com/view/ACDLTM/2016/ENU/?guid=GUID-30F44A49-4250-42D1-AEF2-5E2914ADB02B ;; List value ;; Default ;;Description (setvar "DIMADEC" TxtPrecision) ;; 0 ;;Angular Dimension Decimal Places ; (setvar "DIMALT" 0) ;; 0 ;;Control of alternative units 0 - Off 1 - On (setvar "DIMALTD" TxtPrecision) ;; 2 / 3 ;;Alternative Units Decimal Places ; (setvar "DIMALTF" 0.0394) ;; 25.4 / 0.0394 ;;Alternative Units Scale Factor ;;(setvar "DIMALTMZF") ;; ;;Alternate sub-zero factor for metric dimensions - Unknown variable ;;(setvar "DIMALTMZS") ;; ;;Alternate sub-zero suffix for metric dimensions - Unknown variable ; (setvar "DIMALTRND" 0.00) ;; 0.00 ;;Alternate units rounding value ; (setvar "DIMALTTD" 3) ;; 2 / 3 ;;Alternative Units Tolerance Decimal Places ; (setvar "DIMALTTZ" 0) ;; 0 ;;Alternate tolerance zero suppression ; (setvar "DIMALTU" 2) ;; 2 ;;Alternative Units Units ; (setvar "DIMALTZ" 0) ;; 0 ;;Alternate unit zero suppression ; (setvar "DIMAPOST" "") ;; "" ;;Prefix and suffix for alternate text ; (setvar "DIMARCSYM" 0) ;; 0 ;;Arc Length Dimension Arc Symbol (setvar "DIMASZ" FontHeight) ;; 0.18 / 2.5 ;;Dimension Line and Leader Line Arrow Heads size ; (setvar "DIMATFIT" 3) ;; 3 ;;Arrow and text fit if distance is too narrow for both ; (setvar "DIMAUNIT" 0) ;; 0 ;;Angular unit format ; (setvar "DIMAZIN" 0) ;; 0 ;;Angular Dimension Depresses leading zeros ; (setvar "DIMBLK" ".") ;; "." ;;Arrow block name "." for closed flled else as properties ; (setvar "DIMBLK1" ".") ;; "." ;;First arrow block name "." for closed flled else as properties ; (setvar "DIMBLK2" ".") ;; "." ;;Second arrow block name "." for closed flled else as properties (setvar "DIMCEN" FontHeight) ;; 0.09 / 2.5 ;;Drawing centre mark for radius or diameter dimensions (setvar "DIMCLRD" LinCol) ;; 0 ;;Colours - Lines, ArrowHeads, Dimension Lines 0: ByLayer, 256 ByBlock (setvar "DIMCLRE" LinCol) ;; 0 ;;Colours - Extension Lines, Centre Marks Colours 0: ByLayer, 256 ByBlock (setvar "DIMCLRT" TxtCol) ;; 0 ;;Colours - Dimension Text Colour 0: ByLayer, 256 ByBlock (setvar "DIMDEC" TxtPrecision) ;; 0 ;;Dimension Decimal Places ; (setvar "DIMDLE" 0) ;; 0.0000 ;;Dimension Line extension with oblique strokes instead of arrows ; (setvar "DIMDLI" 4) ;; 3.75 ;;Dimension Baseline Dimension Spacing (setvar "DIMDSEP" ".") ;; . ;;Decimal separator (setvar "DIMEXE" (/ Fontheight 2)) ;; 0.18 / 1.25 ;;Extension Line Extension distance (setvar "DIMEXO" (/ Fontheight 4)) ;; 0.0625 / 0.625 ;;Extension Line Offset ; (setvar "DIMFRAC" 0) ;; 0 ;;Dimension Fraction Format ; (setvar "DIMFXL" 1.00) ;; 1 ;;Fixed Extension Line ; (setvar "DIMFXLON" 0) ;; 0 ;;Enable Fixed Extension Line 0 - Off 1 - On (setvar "DIMGAP" (/ FontHeight 4)) ;; 0.09 / 0.625 ;;Dimension gap between text and arrow (setvar "DIMJOGANG" (* pi (/ 45 180.0))) ;; ;;Radius dimension jog angle.. radians? ; (setvar "DIMJUST" 0) ;; 0 ;;Justification of text on dimension line (setvar "DIMLDRBLK" ".") ;; "." ;;Leader block name "." for closed flled else as properties ; (setvar "DIMLFAC" 1.00) ;; 1 ;;Linear unit scale factor ; (setvar "DIMLIM" 0) ;; 0 ;;Generate dimension limits 0 - Off 1 - On (setvar "DIMLTEX1" "BYBLOCK") ;; "." ;;Linetype extension line 1 (setvar "DIMLTEX2" "BYBLOCK") ;; "." ;;Linetype extension line 2 (setvar "DIMLTYPE" "BYBLOCK") ;; "." ;;Dimension linetype ; (setvar "DIMLUNIT" 2) ;; 2 ;;Dimension Units (except angular) - number type ; (setvar "DIMLWD" -2) ;; -2 ;;Dimension Line Lineweights ; (setvar "DIMLWE" -2) ;; -2 ;;Extension Line Line Weight ;;(setvar "DIMMZF") ;; ;;Sub-zero factor for metric dimensions - Unknown variable ;;(setvar "DIMMZS") ;; ;;Sub-zero suffix for metric dimensions - Unknown variable ; (setvar "DIMPOST" "") ;; "" ;;Prefix and suffix for dimension text ; (setvar "DIMRND" 0) ;; 0 ;;Dimension Round distance to nearest n ; (setvar "DIMSAH" 0) ;; 0 ;;Separate arrow blocks 0 - Off 1 - On ; (setvar "DIMSCALE" 1) ;; 1 ;;Dimension Scale Factor ; (setvar "DIMSD1" 0) ;; 0 ;;Suppress the first dimension line 0 - Off 1 - On ; (setvar "DIMSD2" 0) ;; 0 ;;Suppress the second dimension line 0 - Off 1 - On ; (setvar "DIMSE1" 0) ;; 0 ;;Suppress the first extension line 0 - Off 1 - On ; (setvar "DIMSE2" 0) ;; 0 ;;Suppress the second extension line 0 - Off 1 - On ; (setvar "DIMSOXD" 0) ;; 0 ;;Suppress outside dimension lines ; (setvar "DIMTAD" 0) ;; 0 ;;Dimension Text Vertical distance ; (setvar "DIMTDEC" 4) ;; 4 ;;Tolerance decimal places ; (setvar "DIMTFAC" 1) ;; 1 ;;Dimension text scale factor of fractions relative to text height ; (setvar "DIMTFILL" 0) ;; 0 ;;Text background enabled ; (setvar "DIMTFILLCLR" 0) ;; 0 ;;Text background color 0: ByLayer, 256 ByBlock ; (setvar "DIMTIH" 0) ;; 0 ;;Text inside extensions is horizontal 0 - Off 1 - On ; (setvar "DIMTIX" 0) ;; 0 ;;Place text inside extensions 0 - Off 1 - On ; (setvar "DIMTM" 0) ;; 0 ;;Dimension Minus tolerance distance when used with dimtol, or dimlim ; (setvar "DIMTMOVE" 0) ;; 0 ;;Text movement ; (setvar "DIMTOFL" 0) ;; 0 ;;Force line inside extension lines 0 - Off 1 - On ; (setvar "DIMTOH" 1) ;; 1 ;;Text outside horizontal 0 - Off 1 - On ; (setvar "DIMTOL" 0) ;; 0 ;;Tolerance dimensioning 0 - Off 1 - On ; (setvar "DIMTOLJ" 1) ;; 0 ;;Tolerance vertical justification ; (setvar "DIMTP" 0) ;; 0 ;;Dimension Plus tolerance distance when used with dimtol, or dimlim ; (setvar "DIMTSZ" 0.00) ;; 0 ;;Tick size ; (setvar "DIMTVP" 0.00) ;; 0 ;;Text vertical position (setvar "DIMTXSTY" FontName) ;; Font ;;Text style (setvar "DIMTXT" FontHeight) ;; 0.18 / 2.5 ;;Dimension text Height ;;(setvar "DIMTXTDIRECTIONOff" 0) ;; ;;Dimension text direction 1 or 0 - NOT SURE IF THIS WORKS ; (setvar "DIMTZIN" 8) ;; 8 ;;Suppresses leading zeros in tolerance values ; (setvar "DIMUPT" 0) ;; 0 ;;User positioned text 0 - Off 1 - On ; (setvar "DIMZIN" 8) ;; 8 ;;Suppresses leading zeroes ;;Set Dimstyle named above to this list (setq dimstylelist (tableSearch "dimstyle")) (if (= (member DimStyleName dimstylelist) nil) (command "dimstyle" "s" DimStyleName) (command "dimstyle" "s" DimStyleName "Y") ) (princ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Hope that sets you on your way a little Edit: Last snippet. If you want to get the entity name of a font style, which you can apply to the add xdata portion from my first code to add annotative to an existing font. (defun c:GetTextStyle ( FontName / ) (Entget (tblobjname "style" FontName)) ;;(entget (tblobjname "Style" FontName) '("AcadAnnotative")) ;; Lists registered app AcadAnnotative entries ) -
In my 5.0b there is a dialogue that lets you uncheck what you want to keep, including stacking - I haven't changed to the more recent versions yet though
-
Saxlle started following Looking for a LISP to evenly space polylines from their end points
-
Looking for a LISP to evenly space polylines from their end points
Saxlle replied to Tamim's topic in AutoLISP, Visual LISP & DCL
Hi @Tamim Try this code and see if it fulfil your needs: ; ******************************************************** ; Functions : ESP (Evenly Spacing the Polylines) ; Description : Evenly Spacing Polylines ; Author : SAXLLE ; Date : October 29, 2025 ; ******************************************************** (prompt "\nTo run a LISP type: ESP (Evenly Spacing the Polylines)") (princ) (defun c:ESP ( / myerr olderr old_osmode flag ss len lst i spacing side base_point inc ent dist_lst npt answ) (setq old_osmode (getvar 'osmode)) (defun myerr (errmsg) (setq *error* olderr) (if (not (member errmsg '("console break" "Function Cancelled")) ) (princ (strcat "\nError: " errmsg ".\nThe application has finished working...")) ) (setvar 'osmode old_osmode) (princ) ) (setq olderr *error* *error* myerr ) (setq flag T) (while (not (equal flag nil)) (setvar 'osmode old_osmode) (prompt "\nSelect Polylines:") (princ) (setq ss (ssget (list (cons 0 "*POLYLINE"))) len (sslength ss) lst (list) i 0 ) (repeat len (setq lst (cons (list (ssname ss i) (getpropertyvalue (ssname ss i) "Length")) lst) i (1+ i) ) ) (initget 1 "Left Right") (setq lst (vl-sort lst (function (lambda (a b) (< (cadr a) (cadr b))))) side (getkword "\nChoose the side? [Left/Right]") spacing (getreal "\nEnter the spacing value:") base_point (getpoint "\nPick the Base Point for spacing:\n") inc spacing i 0 ) (setvar 'osmode 0) (command-s "_UNDO" "begin") (while (< i (length lst)) (setq ent (car (nth i lst)) dist_lst (list) dist_lst (mapcar (function (lambda (x) (distance (car x) (cadr x)))) (mapcar 'list (setq pt_list (mapcar 'cdr (vl-remove-if-not (function (lambda (x) (= (car x) 10))) (entget (car (nth i lst)))))) (cdr pt_list))) ) (if (= side "Left") (progn (setq npt (list (- (car base_point) inc) (cadr base_point) (caddr base_point))) ;; to the Left, using "-" sign (command-s "_pline" npt (strcat "@" (rtos (car dist_lst) 2 2) "<90") (strcat "@" (rtos (- (cadr dist_lst) inc) 2 2) "<180") (strcat "@" (rtos (caddr dist_lst) 2 2) "<270") "") ) (progn (setq npt (list (+ (car base_point) inc) (cadr base_point) (caddr base_point))) ;; to the Right, using "+" sign (command-s "_pline" npt (strcat "@" (rtos (car dist_lst) 2 2) "<90") (strcat "@" (rtos (- (cadr dist_lst) inc) 2 2) "<0") (strcat "@" (rtos (caddr dist_lst) 2 2) "<270") "") ) ) (entdel (car (nth i lst))) (setq inc (+ inc spacing) i (1+ i) ) ) (command-s "_UNDO" "end") (initget 1 "Yes No Undo") (setq answ (getkword "\Do you want to continue? [Yes/No/Undo]")) (cond ((equal answ "No") (setvar 'osmode old_osmode) (setq flag nil) ) ((equal answ "Undo") (command-s "_UNDO" "") ) ) ) (prompt "\The polylines are evenly spaced!") (princ) ) Also, you can see the short video of how does lisp are working. EvenlySpacingPolyline.mp4 Best regards. -
pallas joined the community
-
Create 3 Center Curves for Polylines
pallas replied to broncos15's topic in AutoLISP, Visual LISP & DCL
You have no idea how long I have been looking for a LISP that does this!!! I tried to hard code some of the values but I am messing it up somewhere (and I don't have enough knowledge of LISP to debut it...). Can someone please let me know how to change the code to put into it the following: (setq ard (* 2 crd)) ; Approach radius (setq erd (* 3 crd)) ; Exit radius (setq aof (* 0.0375 crd)) ; Approach offset (setq eof (* 0.1236 crd)) ; Exit offset Basically, I just want one prompt for the middle radius, the rest are calculated with the above formulas.
