All Activity
- Past hour
-
gilsoto13 started following Deleting Hatch from Blocks
-
you da man
- Today
-
Copy blocks to curve according to another curve
devitg replied to HypnoS's topic in AutoLISP, Visual LISP & DCL
- 25 replies
-
- autolisp
- block position
-
(and 3 more)
Tagged with:
-
Some of you may already be familiar with CADCAL, which brings the full functionality of Autodesk's GeomCAL to BricsCAD. Now there's a new program with significantly expanded functionality. As before, it's available free of charge; download from https://www.calscript.com/home.html What's new? 1. CADCAL has been enhanced with several new features, most notably, the input of cylindrical coordinates is now possible. An overview of the functions that can be called with the CAL command can be found here: https://www.calscript.com/cal-ddcal.html#listofcal 2. There's a new DDCAL command, which is controlled via a dialog box. The main advantage is that you no longer have to memorize the many CAL functions or laboriously search for them in the documentation; instead, you can select them directly from a list box in the dialog. A description is also displayed for each function selected in the list box. CAL expressions entered and evaluated using the DDCAL command are saved as a history in the DWG. The history is displayed in the DDCAL dialog, and you can always access these CAL expressions and their results (!) later. Even after closing the CAD session and reopening the DWG, even on other computers. You can find the description of DDCAL here: https://www.calscript.com/cal-ddcal.html#ddcal 3. CALScript offers something completely new. This program was developed based on the observation that users use CAD scripts in which mathematical expressions are calculated using CADCAL/GeomCAL and used to generate parametrically defined drawing parts. CALScript can be used as a variant design program, with more options than dynamic blocks. Absolutely no programming is required; the variant definitions are simply created via scripts. These scripts look exactly like conventional CAD scripts, but you can also enter user input within them. CALScript executes such a script by translating the script into Lisp. This translation function is also available to the user, providing them with a ready-made Lisp function that they can also integrate into their own applications. And because you can call Lisp functions in scripts, you can also make your existing Lisp functions "smart" simply by embedding the function in a CALScript script. The CALScript objects can be edited later, and they can even communicate with each other to model/simulate any system. For a first introduction to CALScript: https://www.calscript.com/calscript-quickstart.html The web pages are still under construction and will be updated. But together with the many demo scripts that come with the installation, you can already get a good impression of the possibilities. Let me know what you think!
-
Copy blocks to curve according to another curve
HypnoS replied to HypnoS's topic in AutoLISP, Visual LISP & DCL
@SLW210 I tried yours but I cant get it to work, I think Im missing something. "Enter the tag to use" What tag am I supposed to type in? Attribute name or value does not work.- 25 replies
-
- autolisp
- block position
-
(and 3 more)
Tagged with:
-
Why not use the specialized toolset MEP? Since it's FREE, I doubt if anyone is very interested in continuing to update/repair the WPIPE LISPs.
-
Copy blocks to curve according to another curve
SLW210 replied to HypnoS's topic in AutoLISP, Visual LISP & DCL
Did you bother to try my code? It asks for a line and distance between blocks.- 25 replies
-
- autolisp
- block position
-
(and 3 more)
Tagged with:
-
Copy blocks to curve according to another curve
HypnoS replied to HypnoS's topic in AutoLISP, Visual LISP & DCL
TBH devito code meets my needs, for what i send big thanks once more. One thing I'd like to be added is to let me change distance between blocks- 25 replies
-
- autolisp
- block position
-
(and 3 more)
Tagged with:
-
I'd like to report a small bug with WPIPE[12] that's does not occur in WPIPE[11]. After choosing all settings user can't change pipe width before drawing like in WPIPE[11]. Typing new width just places first point of pipe.
-
So when I open the file it's readable but when I try to write to it using write-line command the characters are displayed in a file as some unknown symbols, so I can't claim for sure that it's a binary file but it's only reason that comes to my mind that can cause such behavior, in addition those functions for reading and writing binary by Lee worked on a file flawless in combo. But yeah, I can't tell for sure it's a binary file, but it's my assumption. Sure, provided below. Thanks for info, I know that because I have Acad at home so I looked into it but on work I searched through whole ZWCAD registry and there's nothing in there, but on the other side I didn't found AppAutoLoad.app file anywhere among Acad files, so I guess ZWCAD put it in a file instead of registry (not sure why but that's how it is). AppAutoLoad.app
-
Why does using a variable for a T/nil outcome in an if statement make it go screwy?
BIGAL replied to ESan's topic in AutoLISP, Visual LISP & DCL
Following on from @mhupp suggestion its pretty easy to do a two item dcl and preset one option. The dcl code is short and can live inside the lisp. (defun wow ( / fo butt val ans) (setq fo (open (setq fname (vl-filename-mktemp "" "" ".dcl")) "w")) (write-line " Presuf : dialog { " fo) (write-line " label =\"Prefix Suffix\" ; " fo) (write-line " : row { " fo) (write-line " : boxed_radio_row { " fo) (write-line " : radio_button { " fo) (write-line " key = \"Rb1\" ; " fo) (write-line " label = \"Prefix\" ; " fo) (write-line " } " fo) (write-line " spacer_1 ; " fo) (write-line " : radio_button { " fo) (write-line " key = \"Rb2\" ; " fo) (write-line " label = \"Suffix\" ; " fo) (write-line " } " fo) (write-line " spacer_1 ; " fo) (write-line " } " fo) (write-line " } " fo) (write-line " spacer_1 ; " fo) (write-line " ok_cancel ; " fo) (write-line " } " fo) (close fo) (setq dcl_id (load_dialog fname)) (if (not (new_dialog "Presuf" dcl_id) ) (exit) ) (setq butt "Rb1") (action_tile "accept" "(setq val (get_tile butt))(done_dialog)") (action_tile "cancel" "(done_dialog)") (start_dialog) (unload_dialog dcl_id) (vl-file-delete fname) (if (= val "1") (setq ans "Pre") (setq ans "Suff") ) (princ ans) ) (wow) -
Adding data to property lookup tables
BIGAL replied to jamami's topic in AutoCAD Drawing Management & Output
This hopefully will make a list of sizes needed. Limited testing, it needs a check for odd numbers added but just did it quick. Odd numbers will need one less even number size and two other sizes to make answer. But its a start. Some one may have a program already. Just test with even numbers. I can see a pattern in the answers for values that have 1 as remainder so will think more. Ok found it start at 7 and every + 6, 7 13 19 25 etc. gives a remainder of 1. (defun c:wow ( / len 6s 5s 4s 3s 2s 6d 5d 4d 3d 2d) (setq len (getint "\nEnter length ")) (setq 6s 0 5s 0 4s 0 3s 0 2s 0) (setq 6d (/ len 6)) (if (>= 6d 1) (progn (setq 6s (fix 6d)) (setq diff (- len (* 6s 6))) (if (= diff 1) (progn (setq len (- len (* (- 6s 1) 6))) (setq 6s (- 6s 1)) ) (setq len (- len (* 6s 6))) ) ) ) (setq 5d (/ len 5)) (if (>= 5d 1) (progn (setq 5s (fix 5d)) (setq len (- len (* 5s 5))) ) ) (setq 4d (/ len 4)) (if (>= 4d 1) (progn (setq 4s (fix 4d)) (setq len (- len (* 4s 4))) ) ) (setq 3d (/ len 3)) (if (>= 3d 1) (progn (setq 3s (fix 3d)) (setq len (- len (* 3s 4))) ) ) (setq 2d (/ len 2)) (if (>= 2d 1) (progn (setq 2s (fix 2d)) (setq len (- len (* 2s 4))) ) ) (princ (setq lst (list 6s 5s 4s 3s 2s))) (princ) ) -
Block definition modification - adding 2 attributes.
BIGAL replied to pefi's topic in .NET, ObjectARX & VBA
This is read an Excel example it just reads an open spreadsheet, and shows the result of a read cells. You could make a list of the cells. For your task you will probably need to use OBDX as you may have different dwg names, OBDX will allow you to change multiple dwgs. ; https://www.cadtutor.net/forum/topic/98627-block-definition-modification-adding-2-attributes/ ; Excel link by AlanH Aug 2025 (defun wow ( / myxl) ; thanks to Lee-mac for this defun ; 58 is Colon ; thanks to Lee-mac for this defun ; www.lee-mac.com ; 44 is comma 9 is tab 34 is space 58 is colon (defun csv->lst58 ( str / pos ) (if (setq pos (vl-string-position 58 str)) (cons (substr str 1 pos) (csv->lst58 (substr str (+ pos 2)))) (list str) ) ) ; get range (defun AH:getrangexl ( / lst1 myrange lst1) (setq lst1 '()) (setq myrange (vlax-get-property (vlax-get-property (vlax-get-property myxl "ActiveSheet") 'UsedRange) 'address)) (setq lst1 (csv->lst58 myrange)) (setq st (vl-string-subst "" "$" (vl-string-subst "" "$" (nth 0 lst1) ))) (setq end (vl-string-subst "" "$" (vl-string-subst "" "$" (nth 1 lst1) ))) (setq row1 (cadr (columnrow st))) (setq endrow (cadr (columnrow end))) (setq endcol (car (columnrow end))) ) ; Alpha2Number - Converts Alpha string into Number ; Function By: Gilles Chanteau from Marseille, France ; Arguments: 1 ; Str$ = String to convert ; Syntax example: (Alpha2Number "ABC") = 731 ;------------------------------------------------------------------------------- (defun Alpha2Number (Str$ / Num#) (if (= 0 (setq Num# (strlen Str$))) 0 (+ (* (- (ascii (strcase (substr Str$ 1 1))) 64) (expt 26 (1- Num#))) (Alpha2Number (substr Str$ 2)) ) ) ) ; ColumnRow - Returns a list of the Column and Row number ; Function By: Gilles Chanteau from Marseille, France ; Arguments: 1 ; Cell$ = Cell ID ; Syntax example: (ColumnRow "ABC987") = '(731 987) ;default to "A1" if there's a problem ;------------------------------------------------------------------------------- (defun ColumnRow (Cell$ / Column$ Char$ Row#) (setq Column$ "") (while (< 64 (ascii (setq Char$ (strcase (substr Cell$ 1 1)))) 91) (setq Column$ (strcat Column$ Char$) Cell$ (substr Cell$ 2) ) ) (if (and (/= Column$ "") (numberp (setq Row# (read Cell$)))) (list (Alpha2Number Column$) Row#) '(1 1) ) ) ;; Thanks to fixo (defun getcell2 (row column / ) (setq cells (vlax-get-property (vlax-get-property myxl "ActiveSheet") "Cells")) (setq cell (vlax-get (vlax-variant-value (vlax-get-property cells "Item" row column)) 'value)) ) (defun openxl ( / ) (setq myxl (vl-catch-all-apply 'vlax-get-or-create-object '("Excel.Application"))) (if (vl-catch-all-error-p myxl) (progn (prompt "\nError: Could not start Excel.") (exit) ) ) (if (= (vlax-get-property (vlax-get-property myXL 'WorkBooks) 'count) 0) (vlax-invoke-method (vlax-get-property myXL 'WorkBooks) 'Add) ) (vla-put-visible myXL :vlax-true) (vlax-put-property myxl 'ScreenUpdating :vlax-true) (vlax-put-property myXL 'DisplayAlerts :vlax-true) (princ) ) ; starts here (openxl) (AH:getrangexl) ; ignore 1st line (setq row (+ row1 1)) (repeat (- endrow 1) (setq dwgname (getcell2 row 1)) (setq bhd_inst (getcell2 row 2)) (setq bhd_line (getcell2 row 3)) (setq bhd_type (getcell2 row 4)) (princ (strcat"\n" dwgname " " bhd_inst " " bhd_line " " bhd_type)) (setq row (1+ row)) ;*********************************** ; do your thing here ;*********************************** ) (if (not (vlax-object-released-p myXL))(progn(vlax-release-object myXL)(setq myXL nil))) (princ) ) (wow) -
mhupp started following Why does using a variable for a T/nil outcome in an if statement make it go screwy?
-
Why does using a variable for a T/nil outcome in an if statement make it go screwy?
mhupp replied to ESan's topic in AutoLISP, Visual LISP & DCL
This is another way of setting a default option from a prompt. (initget "Prefix Suffix") (setq rep (cond ((getkword "\nAdd Text @ [Prefix/<Suffix>]: ")) ("Suffix") ) ) This will prompt the user "Add Text @ [Prefix/<Suffix>]:" just visually using < > to mark the default answer. if the user hits enter on the prompt the kword isn't set so rep defaults to "Suffix" Using cond instead of if's & wrapping it with getkword means the user doesn't have to type out exactly Prefix or Suffix . to then trigger other if's later in the lisp. -
Adding data to property lookup tables
BIGAL replied to jamami's topic in AutoCAD Drawing Management & Output
There has been some other program requests ignoring dynamic for moment that take say 13 and work out the beams to make a 13m length. It looks like your doing that or is that why you want a look up table, so get 1-1-2-3 etc You can normally get at any property in a dynamic block so you could skip the select length and enter a length value then the block would be updated. I can see what your using. So using the great program by Lee-mac Dynamic block.lsp you can set say the correct visibilty. Just a question would you be happy using a row function much easier than trying to do some 50+ visibility states. 50 = 8 x 6m + 1 x 2m length so how would that be done as a look up ? 6-6-6-6-6....... Much easier to just make as a row of 6 plus a 2. Same with setting correct end. Have a look at video. Do windows.mp4 - Yesterday
-
Hiding LISP code in CUI button
BIGAL replied to Strydaris's topic in The CUI, Hatches, Linetypes, Scripts & Macros
If you make a Text menu item then can have sub menu in a pop up and set the text height and style to use then call text, so could have multiple Text select. -
I looked at the file and its plain ascii text, are you sure need to write a binary file ? I used to have DEBUG so could look at a file and see if its plain text or binary. Can you post a file that has more than one line please. Just a comment in Acad and Bricscad the start up suite is contained in the registry.
-
How to stop attributes from mirroring in nested blocks
jamami replied to jamami's topic in AutoCAD Drawing Management & Output
Just fixed this by using flip action . -
Adding data to property lookup tables
jamami replied to jamami's topic in AutoCAD Drawing Management & Output
Forgot to add I only populated 2m,3m and 14m on the middle drop down to test the movements and visibilities . the other sizes won’t do anything when selected . -
Why does using a variable for a T/nil outcome in an if statement make it go screwy?
pkenewell replied to ESan's topic in AutoLISP, Visual LISP & DCL
@ESan I'm not sure what you mean exactly. The structure of an IF statement is: (IF <function or variable evaluates as True> <THEN perform statement or function and return value> <ELSE if not True, perform the statement or function and return value>) NOTE: the IF function doesn't return T or NIL by itself, it returns the results of the statement or function in the THEN or ELSE parts. Example with extra commenting: (defun C:IF () (setq i (getint "\nEnter a Number or ENTER for nothing: ")) (if i ;<-- IF "i" evaluates to not Nil or T (true) ;THEN perform the following. NOTE all must evaluate to a single return, hence why (progn) is used to do multiple actions. (progn (princ (strcat "\nYou entered the number " (itoa i) ". ")); Use i in print to command line T ; Return T - Otherwise (princ) doesn't return anything. ) ; ELSE if "i" evaluates to NIL, perform the following. NOTE all must evaluate to a single return, hence why (progn) is used to do multiple actions. (progn (Princ "\n You did not enter anything. "); Print to the command line that nothing was given. nil ; Return NIL - Otherwise (princ) doesn't return anything. ) ) ) -
Strydaris started following How to deploy list of Lisps to everyone in the organisation - AutoCAD LT
-
How to deploy list of Lisps to everyone in the organisation - AutoCAD LT
Strydaris replied to CivilTechSource's topic in AutoLISP, Visual LISP & DCL
@CivilTechSource I'm not as good at the whole CAD customization as some or maybe all of the guys in this thread but here is what I do at my office. 1) I get everyone to add a line to their Support File Search Path. The line I get them to add is located on our server so everyone has access to it. For example my line is "G:\Support_Files\Autolisp\_LoadOnStart" where the G:\ is a network drive and the Autolisp folder contains all our Autolisps. 2)I add the same folder into the Trusted Locations section. Or in this case I would just this line. "G:\Support_Files\Autolisp\..." The 3 periods at the end means also include every folder here after. 3) Once thats all setup then AutoCAD should start loading all acad.lsp & acaddoc.lsp or acadlt.lsp & acadltdoc.lsp when you start CAD or open a file. 4) I created an acadltdoc.lsp file and put my load, autoload or system variables in there. Here is a small snippet of what I load when users open a file.... Here is what I do for system variables and to make sure they are the same across the company. Doing this has helped and has decreased the amount of times I get asked why something isnt working. I have more variables then written here. This is just an example. ;;Set system variables that need to be set for Cassidy & Co CAD Standards (defun-q MYSTARTUP () (SETVAR "REGENMODE" 1) (SETVAR "GRIDMODE" 0);Turns off the grid (SETVAR "SNAPMODE" 0);Turns off snap to grid (SETVAR "MIRRTEXT" 0);Text will mirror (SETVAR "BINDTYPE" 1);Changes Xref Bind types. ie Setting to 1 will remove the xref files name from the layer name. (SETVAR "DIMASSOC" 1);Sets dims to be non-associated to objects (SETVAR "VISRETAIN" 1) (SETVAR "FILEDIA" 1);Yes (SETVAR "ATTDIA" 1);Yes (SETVAR "ATTREQ" 1);Yes (SETVAR "INSBASE" (list 0.0 0.0 0.0));Yes (SETVAR "SAVETIME" 10) (SETVAR "XREFNOTIFY" 2) (SETVAR "TRANSPARENCYDISPLAY" 1) (SETVAR "FIELDEVAL" 31) (PRINC) ) For LISP Routines I do this..... (setq S::STARTUP (append S::STARTUP MYSTARTUP)) (load "G:/Support_Files/Autolisp/SubFunctions.lsp") (load "G:/Support_Files/Autolisp/_LoadOnStart/TipV1-1.lsp") ;;Areas (autoload "G:/Support_Files/Autolisp/Area Calcs/Areas2AttributeV1-2.lsp" '("A2A")) (autoload "G:/Support_Files/Autolisp/Area Calcs/Areas2FieldV1-3.lsp" '("A2F")) The LOAD section will directly load the Lisps as the file loads. The AUTOLOAD section will load the lisp when the command at the end is written. For example if A2A or A2F typed out then the lisp will load and run the command. -
Hiding LISP code in CUI button
Strydaris replied to Strydaris's topic in The CUI, Hatches, Linetypes, Scripts & Macros
@CivilTechSource You could do it that way, but I wouldnt . I would use the built in Styles and have the user select which style to use. If using AutoCAD you should expect the user to have a certain level of usability in the work space. If they dont have the level then do not make it easier for them, make them use CAD the way its intended. By doing that you are making sure that they learn CAD and also use the office CAD Standards how they are intended to be used. -
increase or decrease value of attdef...help
leonucadomi replied to leonucadomi's topic in AutoLISP, Visual LISP & DCL
EXCELLENT MASTER , THANK YOU -
Hiding LISP code in CUI button
CivilTechSource replied to Strydaris's topic in The CUI, Hatches, Linetypes, Scripts & Macros
That is really handy to know! Would it be wise to create a Textbox in the CUI where the user can input a number eg. text height and then all lisps that run can use the text height specified globally? -
Why does using a variable for a T/nil outcome in an if statement make it go screwy?
ESan replied to ESan's topic in AutoLISP, Visual LISP & DCL
Does the first set of code not automatically check for a nil option? From my understanding, the if function has a T and nil outcome and needs both to work. If the statement is true, carry out the first (T) option, if not, carry out the second (nil) option. -
Why does using a variable for a T/nil outcome in an if statement make it go screwy?
ESan replied to ESan's topic in AutoLISP, Visual LISP & DCL
Ah, I wasn't 100% sure if it was or not. When I was testing this out, my command was just "OK". I thought I would change it to something more appropriate for clarity. Does the if function not automatically evaluate the T and nil outcomes? Using eval in place of just the variable does fix the issue when printing to the command line, however it does not work when asking it to perform an action, such as changing the users layer if inp does not equal1. If 1 is entered, it will show the correct evaluated option in the command line, but carry out the nil value regardless- changing the users layer as well. I might be trying to understand the if function in a situation where it is not realistically used. But I am not sure I know enough to know that either