Jump to content

All Activity

This stream auto-updates

  1. Past hour
  2. 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.
  3. BIGAL

    Read/Write Binary Files

    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.
  4. Today
  5. Just fixed this by using flip action .
  6. 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 .
  7. @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. ) ) )
  8. @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.
  9. @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.
  10. leonucadomi

    increase or decrease value of attdef...help

    EXCELLENT MASTER , THANK YOU
  11. 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?
  12. 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.
  13. 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
  14. I did not know that was a feature, sorry about that!!
  15. rsdonna

    TCOUNT for multileaders

    This one is great! I'd love to see the updated one when its ready. I didn't realize I had tried it with the other version, but this one works great. Thanks again
  16. oh posted at the same time as pkenewell :-)
  17. first of all , if is a built in command so c:if I don't think works second , yes and no are variables not functions so you could use (setq yes "\nYes") and then use (eval yes) better would be : (defun c:whatif (/ inp yes no) (setq yes "Yes" no "No") (if (= (setq inp (getint "\nValue: ")) 1)(eval yes)(eval no)) ;;; or (if (= (setq inp (getint "\nValue: ")) 1)(princ "\nyes")(princ "\nNo")) (princ) )
  18. If you want to use an IF statement with a variable that could be something or NIL, simply use this construct: (defun C:IF () (setq i (getint "\nEnter a Number or ENTER for nothing: ")) (if i ;<-- If not nil (progn (princ (strcat "\nYou entered the number " (itoa i) ". ")) T ) (progn (Princ "\n You did not enter anything. ") nil ) ) ) Conversely if you want to check for a NIL condition: (defun C:IF () (setq i (getint "\nEnter a Number or ENTER for nothing: ")) (if (not i) ;<-- If nil (progn (Princ "\n You did not enter anything. ") nil ) (progn (princ (strcat "\nYou entered the number " (itoa i) ". ")) T ) ) )
  19. SLW210

    TCOUNT for multileaders

    Yes, that had some issues, I think I have that sorted, but not ready to repost. Still working on adding the DCL to it. It happens to me all of the time. No worries!
  20. Please use Code Tags for your code in the future. (<> in the editor toolbar)
  21. I have recently updated a batch of blocks changing all labels from text to attributes, the idea being to stop them mirroring. After competing this task I find that the attribute text still mirrors. I think it is because the attributed blocks are nested. Is there any way to stop this? The attached block shows the issue. jam2.dwg
  22. Hi This is a pretty complex block attached. All the parts are spaced out at mo while I am getting things working, once done they are all moved in line. We make beams 2,3,4,5&6m lengths. To make up 7m we use 4+3, to make up 8 we use 5+3, 9-5+4, 10-6+4, ....13-6+4+3 etc etc. i have defined the available viz states Issue is we terminate the beam ends in 1 of 3 ways also we run beams lengths upto 50m at times. Only 1 viz state allowed in autocad (although i did see a link containing a block with multiple viz states but i think that involves some pretty high end programming skills), so I have been playing with using dummy parameters. It works well (attached). My issue is that I need to create many many hundreds of lines of data to encompass the full range I am looking for . jam1.dwg
  23. After being stuck on this subject for a while, I know the answer is "don't use variables for the actions of an if statement" but I am still bothered as to WHY it does not work. I assume it has to do with the way the if function evaluates, but I cannot figure it out myself. I apologize in advance for the long read. For example, I created a short routine to give a positive or negative response dependent on whether or not the user input equals 1: (defun c:if (/ inp) (setq inp (getint "\nValue: ")) (if (= 1 inp) (print "You Did It!!!!!!!!!") (print "You FAILED") ) (princ) ) This routine works- I provide the action for the T or nil outcome within the if statement. However, if I assign variables instead: (defun c:if (/ inp yes no) (setq inp (getint "\nValue: ") yes (print "You Did It!!!!!") no (print "You FAILED") ) (if (= 1 inp) yes no) (princ) ) The routine doesn't know what to do with itself regardless of user input. It returns the nil outcome twice regardless of whether or not the user input value equals 1. I do not understand why it skips to the nil outcome if the statement is true.
  24. rsdonna

    TCOUNT for multileaders

    After seeing your post I realized I was trying it with the wrong LISP. I was trying it with TMTMS and that was giving me the results that had the space and wasn't numbering anything. Just tried it with this one 'FNRSEQ' and it works perfectly. Thank you so much for this.
  25. Fidelojo

    Read/Write Binary Files

    Thanks for this, learned something new, much cleaner and easier. I tried your suggestion, but didn't work, I also did some more testing and the reading of the data is done properly, the appending of the new content is done properly, and then I think the problem occurs when creating safearray using value 17 or in other words using VisualLisp variant data type vlax-vbByte, which is unsupported according to this post. So the value that has been returned from vlax-variant-type performed on result of reading with (LM:ReadBinaryStream (findfile "../AppAutoLoad.app") nil) is 8209 which is value of vlax-vbArray(8192) combined with vlax-vbByte(17), but since the vlax-vbByte data type seems to be unsupported I guess that I can't recreate the variant of the same type (8209) anymore?
  26. Thank you very much! I'm not sure if I understand you, you mean reading excel directly using AutoLISP? I never tried to do anything with excel and LISP together. When I have data in excel I use VBA and calling LISP scripts from VBA. The sample data set attached - there are 4 columns, file, bhd_ins - block handle that needs to get the "data injection", bhd_type and bhd_line - are the names of attributes in that block. The block handles in the sample set correspond to the real handles on the sample drawing. The content of bhd_type and bhd_line is made up, but that won't make a difference. sample_drawing.dwg handle_table.xlsx
  27. Lee Mac

    Read/Write Binary Files

    FWIW, you can change this: (mapcar 'ascii (MM:strToLst text)) To: (vl-string->list text) An untested suggestion: where the variant is concerned, rather than using hardcoded variant & safearray datatypes, try querying the types of the original variant & safearray using: vlax-variant-type vlax-safearray-type
  1. Load more activity
×
×
  • Create New...