Jump to content

Search the Community

Showing results for tags 'lisp lsp'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • CADTutor
    • News, Announcements & FAQ
    • Feedback
  • AutoCAD
    • AutoCAD Beginners' Area
    • AutoCAD 2D Drafting, Object Properties & Interface
    • AutoCAD Drawing Management & Output
    • AutoCAD 3D Modelling & Rendering
    • AutoCAD Vertical Products
    • AutoCAD LT
    • CAD Management
    • AutoCAD Bugs, Error Messages & Quirks
    • AutoCAD General
    • AutoCAD Blogs
  • AutoCAD Customization
    • The CUI, Hatches, Linetypes, Scripts & Macros
    • AutoLISP, Visual LISP & DCL
    • .NET, ObjectARX & VBA
    • Application Beta Testing
    • Application Archive
  • Other Autodesk Products
    • Autodesk 3ds Max
    • Autodesk Revit
    • Autodesk Inventor
    • Autodesk Software General
  • Other CAD Products
    • BricsCAD
    • SketchUp
    • Rhino
    • SolidWorks
    • MicroStation
    • Design Software
    • Catch All
  • Resources
    • Tutorials & Tips'n'Tricks
    • AutoCAD Museum
    • Blocks, Images, Models & Materials
    • Useful Links
  • Community
    • Introduce Yourself
    • Showcase
    • Work In Progress
    • Jobs & Training
    • Chat
    • Competitions


  • Programs and Scripts
  • 2D AutoCAD Blocks
  • 3D AutoCAD Blocks
  • Images
    • Backgrounds

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...

  1. I Have lisp for placing slope and arrow with polyline and i want enhance this to what i need mention in my drawing file..so i have attached lisp & sample drawing file . and also want to enhance lisp for select all polyline at once, currently lisp select on object at once. thanks. Slope.lsp SLOPE SAMPLE.dwg
  2. MCOLLAR.LSPMCOLLAR.DCL Collar Drawing.dwg Hey Guys yet with another question: I created this DCL that has 5 user input and I would like it to draw this complicated collar for me. Basically, the size of the mast (monopole diameter) is given together with the thickness of the collar plate (which is the same thickness for the ring plate), then there are some fixed values that can be assumed to draw this. Hopefully 1/3 can be drawn and then array at 120 deg. DWG I posted would be a better representative. The number of bolts (5 rows shown on this picture) is only the best fit for the support - I would like it to give me all options to choose from (3 bolt pattern all the way to 9 rows). Then to make it even harder, I would like to create a shop drawing (as shown on dwg) that has detailed plan so it really should be drawn in 4 pieces (for that 1/3 of the pie) to then assign layer and hatch. Can someone drag me to the right direction and show me how to draw stuff with different arcs and trims and offsets PLEASE! I was so excited to finally show drop down menu on a DCL, now that is done, I do not know how to draw an arc with specific geometry in lisp. Thanks
  3. Sambuddy


    I had a problem in the past whereby the first page appeared blank and I pulled out my hair to fix it - now that this problem is over I am back to yet give it another try to see if I can make this routine successful. Upon entering "PUB" command I would have three options (1st one uses autopub) (second is the one with the problem) (3rd only sets the correct page setup). I tried to use ghostscript but with no success - I then jupmed in to use another application as shell command (PDFTK builder) but that did not panout either. I would like basically the "PDF-SELECTION" option to select page setup, then select layout, then create and combine PDF. shout out to LEE MAC, BIGAL, ROY_43 for their earlier responses and helping me get started. the question is: how can I combine single PDFs with their correct layout names into one pdf file with the project name? I read about the discussions on this platform between @Roy_043 and @BIGAL but could not make the combined pdf. Please help! Thanks (defun c:PUB () (c:CDI) (c:PUB-MENU-OPTION) (princ) ) ;; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ;; ;; SET-PG-LAY ==> SETS PAGE LAYOUT FOR ALL TABS ;; ;; LM:listfort ==> LEE MAC LISTBOX DCL ;; ;; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ;; (defun c:SET-PG-LAY ( / col doc itm lst ) (setq doc (vla-get-activedocument (vlax-get-acad-object)) col (vla-get-plotconfigurations doc) ) (cond ( (zerop (vla-get-count col)) (princ "\nNo Page Setups found.") ) ( (null (setq itm (LM:listfort "Select Page Setup to Apply" (progn (vlax-for x col (setq lst (cons (vla-get-name x) lst))) (acad_strlsort lst) ) 0 ) ) ) (princ "\n*Cancel*") ) ( (setq itm (vla-item col (car itm))) (vlax-for x (vla-get-layouts doc) (if (/= "MODEL" (strcase (vla-get-name x))) (vla-copyfrom x itm) ) ) ) ) (princ) ) ;END DEFUN ;; List Box - Lee Mac ;; Displays a DCL list box allowing the user to make a selection from the supplied data. ;; msg - [str] Dialog label ;; lst - [lst] List of strings to display ;; bit - [int] 1=allow multiple; 2=return indexes ;; Returns: [lst] List of selected items/indexes, else nil (defun LM:listfort ( msg lst bit / dch des tmp rtn ) (cond ( (not (and (setq tmp (vl-filename-mktemp nil nil ".dcl")) (setq des (open tmp "w")) (write-line (strcat "listbox:dialog{label=\"" msg "\";spacer;:list_box{key=\"list\";multiple_select=" (if (= 1 (logand 1 bit)) "true" "false") ";width=36;height=52;}spacer;ok_cancel;}" ) des ) (not (close des)) (< 0 (setq dch (load_dialog tmp))) (new_dialog "listbox" dch) ) ) (prompt "\nError Loading List Box Dialog.") ) ( t (start_list "list") (foreach itm lst (add_list itm)) (end_list) (setq rtn (set_tile "list" "0")) (action_tile "list" "(setq rtn $value)") (setq rtn (if (= 1 (start_dialog)) (if (= 2 (logand 2 bit)) (read (strcat "(" rtn ")")) (mapcar '(lambda ( x ) (nth x lst)) (read (strcat "(" rtn ")"))) ) ) ) ) ) (if (< 0 dch) (unload_dialog dch) ) (if (and tmp (setq tmp (findfile tmp))) (vl-file-delete tmp) ) rtn ) (vl-load-com) (princ) ;;------------------------------------------------------------------------------------------------------------------------------------------------------------------;; ;; END OF ;; ;; [SET-PG-LAY] ;; ;;------------------------------------------------------------------------------------------------------------------------------------------------------------------;; ;; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ;; ;; ^[PUBLISH-LIST-LAYOUT-PDF]^ ;; ;; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ;; ;; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ;; ;; PUBLISH-LIST-LAYOUT-PDF ==> PLOT TABS ;; ;; LM:FiltListBox ==> LEE MAC LISTBOX DCL & IGAL AVERBUH ;; ;; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ;; (defun c:PUBLISH-LIST-LAYOUT-PDF ( / itm lst BACKGROUNDPLT ) (setq BACKGROUNDPLT (getvar 'BACKGROUNDPLOT)) (setvar "BACKGROUNDPLOT" 0) (setvar 'TRAYTIMEOUT 1) (setq lst (LM:FiltListBox "Select Layouts to Plot" (layoutlist) T )) (foreach itm lst ;; For every 'itm' in the list given by 'lst' (setvar 'LTSCALE 1) (setvar 'PSLTSCALE 0) (setvar 'CTab itm) (setq pdfmergedfilename (getvar "dwgname")) (setq pdfsinglefileloc (strcat "C:\\Temp\\PDF\\"(getvar "Ctab"))) (command "-PLOT" "N" "" "" "" pdfsinglefileloc "N" "Y") (princ (strcat "\nPlotting Layout \"" itm "\" " )) ) ;; end foreach (if (= (getvar "tilemode") 0) (setvar "tilemode" 1)) ; Go back to MSPACE ; make a batch file ? ;gs -sDEVICE=pdfwrite \ ; -dNOPAUSE -dBATCH -dSAFER \ ; -sOutputFile=combined.pdf \ ; first.pdf \ ; second.pdf \ ; third.pdf [...] ;Ghostscript (http://www.ghostscript.com/) can be used to combine PDFs. ; Something like this should work: by Roy_043 (defun KGA_String_Join (strLst delim) (if strLst (apply 'strcat (cons (car strLst) (mapcar '(lambda (a) (strcat delim a)) (cdr strLst)) ) ) "" ) ) (CombinePdf (setq gsexe "C:\\Program Files\\gs\\gs9.50\\bin\\gswin64c") (setq srcFileLst '("C:\\Temp\\*.pdf")) (setq trgfile "C:\\Acadtemp\\Total.pdf") ) ; Note: Existing trgFile will be overwritten. (defun CombinePdf (gsExe srcFileLst trgFile) (startapp (strcat gsExe " " "-sDEVICE=pdfwrite -dBATCH -dNOPAUSE -dQUIET " "-sOutputFile=\"" trgFile "\" " "\"" (KGA_String_Join srcFileLst "\" \"") "\"" ) ) ) (princ) ) ;END DEDUN ;;------------------------------------------------------------------------------------------------------------------------------------------------------------------;; ;; END OF ;; ;; [PUBLISH-LIST-LAYOUT-PDF] ;; ;;------------------------------------------------------------------------------------------------------------------------------------------------------------------;; ;; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ;; ;; ^[PUBLISH-LIST-LAYOUT-PLOT]^ ;; ;; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ;; ;; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ;; ;; PUBLISH-LIST-LAYOUT-PLOT ==> PLOT TABS ;; ;; LM:FiltListBox ==> LEE MAC LISTBOX DCL & IGAL AVERBUH ;; ;; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ;; (defun c:PUBLISH-LIST-LAYOUT-PLOT ( / itm lst BACKGROUNDPLT ) (setq BACKGROUNDPLT (getvar 'BACKGROUNDPLOT)) (setvar "BACKGROUNDPLOT" 0) (setvar 'TRAYTIMEOUT 1) (setq lst (LM:FiltListBox "Select Layouts to Plot" (layoutlist) T )) (foreach itm lst ;; For every 'itm' in the list given by 'lst' (setvar 'LTSCALE 1) (setvar 'PSLTSCALE 0) (setvar 'CTab itm) (COMMAND "-PLOT" "N" "" "" "" "" "N" "Y") (princ (strcat "\nPlotting Layout \"" itm "\" " )) ) ;; end foreach (if (= (getvar "tilemode") 0) (setvar "tilemode" 1)) ; Go back to MSPACE (princ) ) ;END DEDUN ;;------------------=={ Filtered List Box }==-----------------;; ;; ;; ;; Displays a list box interface from which the user may ;; ;; select one or more items. Includes an edit box filter ;; ;; to enable the user to filter the displayed list of items. ;; ;;------------------------------------------------------------;; ;; Author: Lee Mac, Copyright © 2013 - www.lee-mac.com ;; ;;------------------------------------------------------------;; ;; Arguments: ;; ;; msg - List box dialog title ;; ;; lst - List of strings to display in the list box ;; ;; mtp - Boolean flag to determine whether the user may ;; ;; select multiple items (T=Allow Multiple) ;; ;;------------------------------------------------------------;; ;; Returns: List of selected items, else nil. ;; ;;------------------------------------------------------------;; (defun LM:FiltListBox ( msg lst mtp / _addlist dch dcl des rtn tmp ) (defun _addlist ( key lst ) (start_list key) (foreach x lst (add_list x)) (end_list) lst ) (if (and (setq dcl (vl-filename-mktemp nil nil ".dcl")) (setq des (open dcl "w")) (write-line (strcat "filtlistbox : dialog { label = \"" msg "\"; spacer;" ": list_box { key = \"lst\"; width = 50; fixed_width = true; height = 15; fixed_height = true; allow_accept = true; " "multiple_select = " (if mtp "true" "false") "; }" ": edit_box { key = \"flt\"; width = 50; fixed_width = true; label = \"Filter:\"; }" "spacer; ok_cancel; }" ) des ) (not (close des)) (< 0 (setq dch (load_dialog dcl))) (new_dialog "filtlistbox" dch) ) (progn (_addlist "lst" (setq tmp lst)) (set_tile "lst" (setq rtn "0")) (set_tile "flt" "*") (action_tile "lst" "(setq rtn $value)") (action_tile "flt" (vl-prin1-to-string '(progn (setq flt (strcat "*" (strcase $value) "*")) (_addlist "lst" (setq tmp (vl-remove-if-not '(lambda ( x ) (wcmatch (strcase x) flt)) lst))) (set_tile "lst" (if (< (atoi rtn) (length tmp)) rtn (setq rtn "0"))) ) ) ) (setq rtn (if (= 1 (start_dialog)) (mapcar '(lambda ( x ) (nth x tmp)) (read (strcat "(" rtn ")"))) ) ) ) ) (if (< 0 dch) (setq dch (unload_dialog dch)) ) (if (and (= 'str (type dcl)) (findfile dcl)) (vl-file-delete dcl) ) rtn ) ;END LM:FiltListBox ;;------------------------------------------------------------------------------------------------------------------------------------------------------------------;; ;; END OF ;; ;; [PUBLISH-LIST-LAYOUT-PLOT] ;; ;;------------------------------------------------------------------------------------------------------------------------------------------------------------------;; ;; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ;; ;; ^[PUBLISH-AUTO-PUBLISH-MATIC]^ ;; ;; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ;; ;; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ;; ;; PUBLISH-AUTO-PUBLISH-MATIC ==> CHANGES THE AUTOMATIC PUBLISH VARIABLE ;; ;; ;; ;; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ;; ;;;AUTOMATICPUB: (defun c:PUBLISH-AUTO-PUBLISH-MATIC (/) (if (= (getvar "AUTOMATICPUB") 1) (setvar "AUTOMATICPUB" 0) (setvar "AUTOMATICPUB" 1) ) (princ (strcat "\nAUTOMATICPUB variable is set to \"" (rtos(getvar "AUTOMATICPUB")) "\" " )) (command "QSave") (setvar "AUTOMATICPUB" 0) (princ) ) ;END DEFUN ;;------------------------------------------------------------------------------------------------------------------------------------------------------------------;; ;; END OF ;; ;; [PUBLISH-AUTO-PUBLISH-MATIC] ;; ;;------------------------------------------------------------------------------------------------------------------------------------------------------------------;;
  4. (robocopy sourcepath destinpath "*.*" "/MIR") (if (newer-p flstxt1 flstxt2) (progn (c:robocopy-T2C) (prompt "******<<< Files are being updated >>>******") (princ) );end_progn if true (progn (prompt "---* No action taken. Files are already up to date! *---") (princ) );end_progn or else );end_if Posted above are a few line from the code I combined that checks to see if a specific txt file is been updated, then executes robocopy to copy/ mirror files from T drive on server to C drive on local PC. The code above is a standalone lisp file that loads based on my code in acaddoc here: ;; LOAD CO-AL-T2C AT AUTOCAD STARTUP ;; IN CASE s::startup EXISTS ON ACADDOC (defun mystartupT2C () (load "C:\\TX Cad Config\\Lisp\\(CO-AL-T2C).LSP") ;; LOCAL DIRECTORY (c:CO-AL-T2C) ) ;END DEFUN (if s::startup (setq s::startup (append s::startup (quote ((mystartupT2C))))) (defun s::startup () (mystartupT2C)) ) ;END IF part of (CO-AL-T2C) is robocopy if you are wondering what (CO-AL-T2C).lsp does. The problem I have is in two parts if anyone cares to comment please: 1) if I am not connected to my VPN server, since it does not find T drive on the server, the entire acaddoc fails to execute, so I would not have command over any other routines that are independent of this routine that should work without being connected to VPN. Any solution? 2) it appears that the above routine (robocopy routine) happens to execute in strangest of circumstances for example when I publish or before attempting to autosave/ backup save I see my message hinting there is an attempt to robocopy even though the routine is in acaddoc and my understanding is that acaddoc only loads when I start of Autocad at the beginning not between commands. Thanks
  5. I am trying to include every dwg extenstion in a list, only then to use for each to set them to read-only. (defun Read_only ( file / fso f ) (setq fso (vlax-create-object "Scripting.FileSystemObject")) (if (not (zerop (vlax-invoke fso 'FileExists file))) (progn (setq f (vlax-invoke fso 'GetFile file)) (vlax-put-property f 'Attributes (boole 7 1 (vlax-get f 'Attributes))) (vlax-release-object f) ) ;END PROGN ) ;END IF (vlax-release-object fso) ) (setq drwnClist (vl-directory-files "C:\\TX Cad Config\\Block\\" "*.dwg" 1)) how do I use a foreach statement to include all files to undergo (Read_only drwnClist)? Thanks
  6. @Lee Mac hopefully you can answer me in your earliest convenience as almost everyone is moving from offices to homes, I am trying to find a way to update PCs. Basically, the overwrite function does not seem to work for me - if I make an update, I am trying to have to so that it updates the files and folders but it does not seem to be happening. I have been twitching this routine but still having the same problem. It does work when I do not have the initial folder but when it exists, it just does not overwrite it. Could you please help! Thanks, As you can see, I am trying to update if "Update CADSET.txt" is updated to then overwrite TX Cad Config folder from T to C drives and overwrite everything (folders and files). Please help (defun LM:copyfolder ( src des ovr / fso rtn ) (if (setq fso (vlax-create-object "scripting.filesystemobject")) (progn (setq rtn (not (or (zerop (vlax-invoke fso 'folderexists src)) (vl-catch-all-error-p (vl-catch-all-apply 'vlax-invoke (list fso 'copyfolder src des (if ovr :vlax-true :vlax-false)) ) ) ) ) ) (vlax-release-object fso) rtn ) ) ); END DEFUN (vl-load-com) ;; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ;; ;;; NEWER OR OLDER CONDITION (defun newer-p ( f1 f2 / compare ) (defun compare ( a b ) (cond ( (> (car a) (car b))) ( (and a b (= (car a) (car b))) (compare (cdr a) (cdr b)) ) ) ) (apply 'compare (mapcar '(lambda ( x ) (vl-list* (car x) (cadr x) (cdddr x))) (mapcar 'vl-file-systime (list f1 f2)) ) ) ) ;END DEFUN ;; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ;; (setq f1 (findfile "T:\\SALLE A DESSIN\\Outils CAD\\Outils configuration\\TX Cad Config\\UPDATE CADSET.txt")) ; source file (setq f2 (findfile "C:\\TX Cad Config\\UPDATE CADSET.txt")) ; destination file (if (newer-p f1 f2) ; if f1 is newer than f2 then (LM:copyfolder "T:\\SALLE A DESSIN\\Outils CAD\\Outils configuration\\TX Cad Config" "C:\\TX Cad Config" ovr) ; copy from T to C drive (princ "\nUpdate is not available - No action taken! \nLa mise à jour n'est pas disponible pour le moment") ; if NOT, then show this message ) ;END IF (princ "this is the next line after update") (princ) this is what I found on https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-folder-lee-mac/td-p/7557504 (vl-load-com) (defun LM:copyfolder ( src des ovr / fso rtn ) (if (setq fso (vlax-create-object "scripting.filesystemobject")) (progn (setq rtn (not (or (zerop (vlax-invoke fso 'folderexists src)) (vl-catch-all-error-p (vl-catch-all-apply 'vlax-invoke (list fso 'copyfolder src des (if ovr :vlax-true :vlax-false)) ) ) ) ) ) (vlax-release-object fso) rtn ) ) ) (defun spi:update ( / FSO localfolder oldfolder) (setq localfolder (findfile "SPI_Ribbon.cuix") localfolder (vl-filename-directory localfolder) oldfolder (strcat localfolder "_alt")) (cond (*akttoday* (alert "Bitte AutoCAD neustarten und nochmals aktualisieren!") (exit)) ((vl-file-directory-p oldfolder) (setq FSO (vlax-create-object "Scripting.FileSystemObject")) (vlax-invoke FSO "DeleteFolder" oldfolder :vlax-true) (vlax-release-object FSO)) ) (cond ((and (not *akttoday*)(vl-file-directory-p localfolder)) (setq *akttoday* 1) (vl-file-rename (strcat localfolder "\\") (strcat oldfolder "\\")) (LM:copyfolder "P:\\CAD\\AutoCAD\\AutoCAD_SPI_Ribbon" localfolder T) (alert "Ribbon erfolgreich aktualisiert! \n\nMenüänderungen erst nach AutoCAD-Neustart vorhanden.")) (*akttoday*) (T (alert "Ordner --> \"AutoCAD_SPI_Ribbon\" \nwurde nicht gefunden!")) ) (prin1) ) ; end of defun
  7. Hey guys, I wrote a routine that automatically change the setting or copy files from server onto C drive. What I am looking for is an idea to invoke these changes each time I make any changes on the source folder. I do not want to search for changes, but rather I was thinking let's say acaddoc evaluate something or through a lisp I tell it to < Update is available. Do you want to update? > for directories on anyone's C Drive if I make any changes on the source directory. I am looking for an idea... I have about 10-15 folders and sub-folders with all bunch of extensions on the server - when I finished editing them, I was thinking to write a routine to say < Ready to distribute? Yes or No > on my end. When I say "Yes", then for computers that are mapped on C drive, they would get a message "Update is available. Do you want to update? yes or no" I am just fiddling with this idea - any better idea? I DO NOT want to invoke it every time a session is starting or autocad is starting - rather a creative way to invoke it... on a different note, How do I evaluate blah.txt for a date change, if outdated then execute the copy routine, if not business as usual? Thanks guys
  8. Hey Guys, I am trying to write a lisp that has 4 or 5 list boxes. "LS1" would be the main list that appears on the first pane. When you click on "General" then second list box then would contain "LS2" as a sub category on the second pane. Then, if for example "LDF" from the second list/ pane is selected, "LS3" would show up on third list box and hopefully upon double clicking, it would insert a block from "LS3" list. Hopefully someone can follow my logic here and provide some help as to how to go about it. Thanks guys. The original lisp in done by Lee Mac in 2015 https://www.theswamp.org/index.php?topic=49169.0 (defun c:CABLE ( / *error* dch dcl des idx ls1 ls2 ls3 ls4 ) (defun *error* ( msg ) (if (and (= 'int (type dch)) (< 0 dch)) (unload_dialog dch) ) (if (= 'file (type des)) (close des) ) (if (and (= 'str (type dcl)) (setq dcl (findfile dcl))) (vl-file-delete dcl) ) (if (and msg (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*"))) (princ (strcat "\nError: " msg)) ) (princ) ) (setq ls1 (list "GENERAL" "BELL" "ROGERS" "VIDÉOTRON" "TELUS" "SUPPORT") ls2 (list "LDF" "AVA" "CNT" "AUTRE") ;; ls1 > "GENERAL" ls3 (list "LDF2-50A" "LDF4-50A" "LDF5-50A" "LDF6-50A" "LDF7-50A") ;; ls2 > "LDF" ls4 (list "AVA5-50A" "AVA6-50A" "AVA7-50A") ;; ls2 > "AVA" ls5 (list "CNT-300" "CNT-400") ;; ls2 > "CNT" ls6 (list "CAT5" "CABLE 2-0" "VXL7-50A" "RG6-FT1" "EWP132-144" "LMR-400") ;; ls2 > "AUTRE" ls7 (list "FO" "DC") ;; ls1 > "BELL" ls8 (list "FO" "DC") ;; ls1 > "ROGERS" ls9 (list "FO" "ALARME" "DC 2-CONDUCTEURS 4-AWG" "DC 12-CONDUCTEURS 8-AWG" "DC HYBRIDE 2-AWG" "DC HYBRIDE 4-AWG" "DC HYBRIDE 6-AWG" "DC HYBRIDE 8-AWG") ;; ls1 > "VIDÉOTRON" ls10 (list "FO" "ALARME" "DC 2-CONDUCTEURS 8-AWG" "DC 6-CONDUCTEURS 8-AWG" "DC 12-CONDUCTEURS 8-AWG" "DC 12-CONDUCTEURS 6x2x6-AWG") ;; ls1 > "TELUS" ls11 (list "LIST YET TO BE MADE") ;; ls1 > "SUPPORT" ); end setq (if (and (setq dcl (vl-filename-mktemp "tmp.dcl")) (setq des (open dcl "w")) (foreach str '( "listbox : list_box" "{" " width = 30;" " height = 40;" " fixed_width = true;" " fixed_height = true;" "}" "example : dialog" "{" " label = \"CÂBLES ET LIGNES + SUPPORT DES CÂBLES\";" " spacer;" " : row" " {" " : listbox { key = \"ls1\"; }" " : listbox { key = \"ls2\"; }" " : listbox { key = \"ls3\"; }" " : listbox { key = \"ls4\"; }" " }" " ok_only;" "}" ) (write-line str des) ) (not (setq des (close des))) (< 0 (setq dch (load_dialog dcl))) (new_dialog "example" dch) ) (progn (fill_list "ls1" ls1) ;;; (action_tile "ls1" ;;; (vl-prin1-to-string ;;; '(if (= 4 $reason) ;;; (setq ls2 (fill_list "ls2" (append ls2 (list (nth (atoi $value) ls1)))) ;;; ls1 (fill_list "ls1" (LM:removenth (atoi $value) ls1)) ;;; ) ;;; ) ;;; ) ;;; ) ;;; (action_tile "ls2" ;;; (vl-prin1-to-string ;;; '(if (= 4 $reason) ;;; (setq ls1 (fill_list "ls1" (append ls1 (list (nth (atoi $value) ls2)))) ;;; ls2 (fill_list "ls2" (LM:removenth (atoi $value) ls2)) ;;; ) ;;; ) ;;; ) ;;; ) (if (and (= 1 (start_dialog)) ls2) (progn (princ "\nThe user selected the following items:") (foreach x ls2 (terpri) (princ x)) ) (princ "\n*Cancel*") ) ) ) (*error* nil) (princ) ) (defun fill_list ( key lst ) (start_list key) (foreach itm lst (add_list itm)) (end_list) lst ) ;; Remove Nth - Lee Mac ;; Removes the item at the nth index in a supplied list (defun LM:removenth ( n l ) (if (and l (< 0 n)) (cons (car l) (LM:removenth (1- n) (cdr l))) (cdr l) ) ) (princ)
  9. hey guys, I am hoping someone can tell me what is wrong with my cad. I have been fiddling around with the autopublish to generate PDF and it seems somehow a variable or something was made incorrect. As a result, each time I publish say PDF or hard copy, first page/ tab of any project appears blank. This seems to be consistant no matter if I change my page setup under publish to any predefined setting. (1st. page is always either blank or extremely small that appears as though it is blank). Any suggestions? Does anyone know what is wrong? Thanks
  10. The lisp below is lee macs Parsing numerical values from a text. I am wondering how to use this to change the colour within the selected Mtext only for real numbers that accompany "m", for example: 112.35m etc... <number> <dot> <number><m> sometimes there is one space between the real number and "m", so if I could first remove the space for every real number within the text for each, then change the colour for each. I gave it try and I seem not to be successful with this task. Thanks ;; Parse Numbers - Lee Mac ;; Parses a list of numerical values from a supplied string. (defun LM:parsenumbers ( str ) ( (lambda ( l ) (read (strcat "(" (vl-list->string (mapcar '(lambda ( a b c ) (if (or (< 47 b 58) (and (= 45 b) (< 47 c 58) (not (< 47 a 58))) (and (= 46 b) (< 47 a 58) (< 47 c 58)) ) b 32 ) ) (cons nil l) l (append (cdr l) '(())) ) ) ")" ) ) ) (vl-string->list str) ) )
  11. hey Guys, I am hoping someone can let me know what is incorrect about my approach here. I have created 2 routines: IMP-CUI: which renames the old "acad.cuix" and bring in my updated one (do not ask why I did not use "vl-file-copy" method as the result was not satisfactory for me anyways). 2016N: which import the profile from a server location and renames the "...(US Metric)" first to then replace it with an updated one with the same name. The result is quite random when I try it on different computers with the same version. Although I can see that the profile is imported, it does not always carry my setting. I keep losing my supported path, etc... each time I twick the routine. My acad.cuix is updated and when I import it manually seems to have all of my options including the checked and unchecked boxes and supported files. I am tried of trying really! the funny thing is that my partial cuix menus load with no issue, but my preferences on option setting is random even on the same computer when I reset setting to default. Can anyone help PLEASE! Recently enough BIGAL was telling me something about .MNR or .MNL files but I have no idea how to process those. Thanks, Bother in need! hah! (defun c:IMP-CUI () ;;; FIND THE USER (setq loginname (getvar "loginname")) ;;; RENAME THE ORIGINAL "acad.cuix" TO "acad_OLD.cuix" (vl-cmdf "shell" (strcat "ren " "\"" (strcat "C:\\Users\\" (getvar "loginname") "\\AppData\\Roaming\\Autodesk\\ACA 2016\\enu\\Support\\acad.cuix") "\" \"" "acad_OLD.cuix" "\"")) ;;; COPY THE UPDATED "acad.cuix" FROM SERVER ONTO SUPPORT FOLDER (command "REGEN" "") (vl-cmdf "shell" (strcat "copy " "\"" "V:\\SALLE A DESSIN\\SAM - OUTILS XLS DWG\\3-LSP XLS\\AutoCAD-PROFILE-CUI MIGRATION\\2016\\acad.cuix" "\" \"" (strcat "C:\\Users\\" (getvar "loginname") "\\AppData\\Roaming\\Autodesk\\ACA 2016\\enu\\Support\\") "\"")) (vl-load-com) (princ) (command "_.close" "_N" "") ); END DEFUN (defun c:2016N () ;---------------------------------------------- PROFILE ----------------------------------------------; ;;; ALL PROFILES "Profilelst" (setq Profilelst (vla-get-profiles (vla-get-preferences (vlax-get-Acad-Object))) ) ;;; "CurrentActive" TO STORE ACTIVE PROFILE (setq CurrentActive (vla-get-ActiveProfile Profilelst) ) ;;; RENAME THE "CurrentActive" IF IT IS: "AutoCAD Architecture (US Metric)" (if (= CurrentActive "AutoCAD Architecture (US Metric)") (vlax-invoke-method Profilelst 'RenameProfile CurrentActive "OLD_Profile") ) ;;; IMPORT PROFILE (setq ImpProfile (vlax-invoke-method Profilelst 'ImportProfile "AutoCAD Architecture (US Metric)" "V:\\SALLE A DESSIN\\SAM - OUTILS XLS DWG\\3-LSP XLS\\AutoCAD-PROFILE-CUI MIGRATION\\2016\\AutoCAD Architecture (US Metric).arg" :vlax-true ) ) ;;; SET "AutoCAD Architecture (US Metric)" AS ACTIVE PROFILE (vla-put-ActiveProfile Profilelst "AutoCAD Architecture (US Metric)" ) ;;; RESET PROFILE (vlax-invoke-method Profilelst 'ResetProfile "AutoCAD Architecture (US Metric)" ) ;;; DELETE "AutoCAD Architecture (US Imperial)" IF EXIST (repeat (vlax-invoke-method Profilelst 'DeleteProfile "AutoCAD Architecture (US Imperial)" "OLD_Profile" "AutoCAD" ) ) (vl-load-com) (princ) ); END DEFUN I FOUND THAT IF I RESET THE PROFILE, IT MESSES UP WITH THE GENERAL SETTING AND REMOVES MAPPING FOR SUPPORTED PATHS! RIGHT NOW WITHOUT THE RESET FUNCTION EVERYTHING SEEMS DANDY AFTER A COUPLE OF TRIES.
  12. Does anyone know where the file is saved each time you load the "LIST" that you saved on this amazing LISP? http://www.lee-mac.com/bfind.html The reason I am asking is because I would like to transfer my list onto another computer but I cannot find where the file is located when you save your list to then "Load search items list"! Thanks
  13. Would anyone help me find and change certain setting I would like to change under Options or preferences: 1) I would like to load and unload a buck of CUIX files - but as always the menu will not show up - I have to then manually do CUILOAD and unload and reload the menus to appear on menu bar. 2) This is taken from BIGAL: (vlax-dump-object (vla-get-files (vla-get-preferences (vlax-get-Acad-object))) T) which helped me a lot in finding many of the settings but I still need to change many more. 3) Anyone please help to find: ; SET OPEN AND SAVE TAB/FILE SAVE/SAVE AS: ; AutoCAD 2013 Drawing (*.dwg) ; AND ; UNDER FILE SAFETY PRECAUTIONS: ; UNCHECK: "Automatic Save" ; SYSTEM TAB/GENERAL OPTIONS ; CHECK "Beep on error in user input" my biggest problem is loading and unloading that results in menus being loaded but not shown on the menu bar: ; UNLOAD "ACA.CUIX" ; LOAD "ACA 20##" ; LOAD ACA FROM "C:\Users\[User]\AppData\Roaming\Autodesk\ACA 20##\enu\Support\ACAD.cuix" ; LOAD ACAD.cuix ; CUSTOM.cuix ; Appmanager.cuix ; acetmain.cuix ; Featuredapps.cuix ; Modeldoc.cuix ; RadicalPurge.cuix I posted something similar and no one replied and many of my questions were resolved by searching through web. But Can anyone help me with those please? Thanks
  14. Below is BIGAL`s wonder from 2011. All of which are amazing and never knew could be done! Imagine a 2020 BIGAL!!! Basically what I was trying to accomplish was to setup or configure my computer to then save the setting for any other but some tasks are proven impossible or not done efficiently. I did use to import workspace and get some of the task done but if there is a way to combine all the features with a lisp, I would be more satisfied. That is to be able to change a certain controls within "Options" settings as well as adding search path for lisp, trusted path, printed path and other controls. Does anyone have a hand into this or a way of instructions as to how my tasks can be done? presently, I have to add each item on the list manually, CUI settings, control other settings and set some criteria one by one. Is there any genius that can help me achieve this? Also due to variety in autocad version, I have to constantly save my workspace, then use a "Hotfix" by Autodesk to suit the version blah blah blah... Thanks ; resets the paths usefull for update versions of Autocad ; by Alan H 2011 ; This sets a reference to the install path of your product ; the gets are their for info maybe other use ; use this to find other settings ;(vlax-dump-object (vla-get-files (vla-get-preferences (vlax-get-Acad-object))) T) (vl-load-com) ; make temp directory ;(vl-mkdir "c:\\AcadTEMP") (setq *files* (vla-get-files (vla-get-preferences (vlax-get-Acad-object)))) ; savepath ;(vla-get-AutoSavepath *files*) (vla-put-AutoSavepath *files* "C:\\AcadTemp") ; custom icons ;(vla-get-CustomIconPath *files*)) (vla-put-CustomIconPath *files* "P:\\Autodesk\\ICONS") ; custom menu ;(vla-get-Menufile *files*)) ;(vla-put-Menufile *files* "C:\\Users\\2013BIGAL") ; printers config ;(vla-get-PrinterConfigPath *files*) (vla-put-PrinterConfigPath *files* "P:\\AutoDESK\\Plotting\\Plot Styles 2011") ; printers style sheet ;(vla-get-PrinterStyleSheetPath *files*) (vla-put-PrinterStyleSheetPath *files* "P:\\AutoDESK\\Plotting\\Plot Styles") ; printer drv's ;(vla-get-PrinterDescPath *files*) (vla-put-PrinterDescPath *files* "P:\\AutoDESK\\Plotting\\Drv") ; print spooler ;(vla-get-PrintSpoolerPath *files*) (vla-put-PrintSpoolerPath *files* "C:\\AcadTemp\\") ; template path ;(vla-get-TemplateDwgPath *files*) (vla-put-TemplateDwgPath *files* "P:\\Autodesk\\c3d Templates") ; template location ;(vla-get-QnewTemplateFile *files*) (vla-put-QnewTemplateFile *files* "P:\\Autodesk\\c3d Templates\\BIGAL.dwt") ;make new support paths exist + new (setq paths (vla-get-SupportPath *files*)) (setq BIGALpaths "P:\\autodesk\\supportfiles; P:\\autodesk\\lisp; P:\\autodesk\\fonts; P:\\autodesk\\hfs fonts;" ) (setq newpath (strcat BIGALpaths paths)) (vla-put-SupportPath *files* newpath) ; Tempdirectory ;(vla-get-TempFilePath *files*)) (vla-put-TempFilePath *files* "C:\\AcadTemp\\") ; PlotLogFilePath = "C:\\Documents and Settings\\ah02490.BIGAL-AD\\local settings\\application data\\autodesk\\c3d 2011\\enu\\" (vla-put-PlotLogFilePath *files* "C:\\AcadTemp\\") ; LogFilePath = "C:\\Documents and Settings\\ah02490.BIGAL-AD\\local settings\\application data\\autodesk\\c3d 2011\\enu\\" (vla-put-LogFilePath *files* "C:\\AcadTemp\\") ; xref temp path ;(vla-get-TempXrefPath *files*)) (vla-put-TempXrefPath *files* "C:\\AcadTemp\\") ; end use of *files* (vlax-release-object *files*) ; exit quitely (princ "All Done") ;;; LOCAL MODE: ---> C:\Cad config ;;; NETWORK MODE customization setting ---> T:\SALLE A DESSIN\Outils CAD\Outils configuration ;;; NETWORK MODE CTD SLIDES ---> T:\SALLE A DESSIN\Outils CAD\Slides ; UNLOAD "ACA.CUIX" ; LOAD "ACA 20##" ; LOAD ACA FROM "C:\Users\[User]\AppData\Roaming\Autodesk\ACA 20##\enu\Support\ACAD.cuix" ; LOAD ACAD.cuix ; CUSTOM.cuix ; Appmanager.cuix ; acetmain.cuix ; Featuredapps.cuix ; Modeldoc.cuix ; RadicalPurge.cuix ; CHANGE VARIABLES ; Menubar 1 ; Startup 1 ; StartMode 1 ; CLOSE/ TERMINATE ALL PALETTES EXCEPT "Properties" & "External Reference" ; DOCK "Properties" PALETT TO LEFT ; DOCK "External Reference" PALETT TO RIGHT ; SET SELECT TEMPLATE *.dwt: NEW TEMPLATE ; PATH: T:\SALLE A DESSIN\Outils CAD\Template ; SUPPORTED FILE SEARCH PATH (LOCAL): ; C:\Cad Config\LISP ; C:\Cad Config\Slides ; C:\Transfer ; TRUSTED LOCATIONS (LOCAL): ; C:\Cad Config\LISP ; PRINTER SUPPORT FILE PATH (LOCAL) ; PRINTER CONFIGURATION SEARTH PATH: ; C:\Cad Config\Plotters ; PRINTER DESCRIPTION FILE SEARCH FILE: ; C:\Cad Config\Plotters\PMP Files ; PLOT STYLE TABLE SEARCH FILE: ; C:\Cad Config\Plotters\Plot Styles ; AUTOMATIC SAVE FILE LOCATION: ; C:\AcadTemp ; C:\Users\[User]\desktop\autosavecad ; TEMPLATE SETTINGS/DRAWING TEMPLATE FILE LOCATION: ; C:\Cad Config\Template ; SUPPORTED FILE SEARCH PATH (NETWORK): ; T:\SALLE A DESSIN\Outils CAD\Outils configuration\Plotters ; T:\SALLE A DESSIN\Outils CAD\Outils configuration\Lisp ; T:\SALLE A DESSIN\Outils CAD\Outils configuration\Slides ; TRUSTED LOCATIONS (NETWORK): ; T:\SALLE A DESSIN\Outils CAD\Outils configuration\Lisp ; PRINTER SUPPORT FILE PATH (NETWORK) ; PRINTER CONFIGURATION SEARTH PATH: ; T:\SALLE A DESSIN\Outils CAD\Outils configuration\Plotters ; PRINTER DESCRIPTION FILE SEARCH FILE: ; T:\SALLE A DESSIN\Outils CAD\Outils configuration\Plotters\PMP Files ; PLOT STYLE TABLE SEARCH FILE: ; T:\SALLE A DESSIN\Outils CAD\Outils configuration\Plotters\Plot Styles ; AUTOMATIC SAVE FILE LOCATION: ; C:\AcadTemp ; C:\Users\[User]\desktop\autosavecad ; TEMPLATE SETTINGS/DRAWING TEMPLATE FILE LOCATION: ; T:\SALLE A DESSIN\Outils CAD\Template ; SET OPEN AND SAVE TAB/FILE SAVE/SAVE AS: ; AutoCAD 2013 Drawing (*.dwg) ; AND ; UNDER FILE SAFETY PRECAUTIONS: ; UNCHECK: "Automatic Save" ; SYSTEM TAB/GENERAL OPTIONS ; CHECK "Beep on error in user input"
  15. Could someone let me know how to use put-string to arrange text by colour so that example: all content in colour #2 remain but contents in colour # 0 and #4 are removed without changing any of the text format or style? I looked up Wmatch but it seems I cannot get anywhere with that. (setq txt(vla-get-TextString(vlax-ename->vla-object (car (entsel))))) (vla-put-textstring obj ...) not quite sure how to deal with : "\\pxse1.01;{\\C2;TEXT1\\PTEST2\\PTEST3}\\P{\\C4;TEST4\\PTEST5\\PTEST6}" to separate specific colours and merge them. I am also thinking if I could ask which colour to remain, then any other colour could just be removed - this way not complication would arise from conditioning the colour numbers. it could simply be Colour #0 + any colour stored on "Colnum" variable to stay. (setq Colnum (getint "\nWhich Colour to Stay")) Any ideas? sample.dwg
  16. I am trying to retrieve the current dimension style on an open cad file to execute some of my other lisps instead of (Alert blah...), but am not successful. Could someone take a quick look at this and let me know where I am getting it wrong? i had a quick look at tblnext and tblsearch and I think it is right! but maybe VLA could do this more efficiently - I have not gotten too deep into LISP though. I also have two standards ( "STANDARD" and "Standard") depending on which one is the current dim style my code changes. is there a way to make it Case sensitive? ; condition based on current dim stlye ; "Tx Arial 1.65" "Tx CityBlueprint 2.38" "Standard" (defun c:test (/ D1) (setq D1 (tblnext "DIMSTYLE")) ; getting current dimstyle name (setq D1 (cdr (assoc 2 D1))) ; getting dimstyle name (while (/= D1 nil) ; if dimstyle is not nil then proceed (setq D1(tblsearch "DIMSTYLE" D1)) ;; searching for dimstyle (cond ( (= (cdr (assoc 2 D1)) "Standard") (alert "Standard is selected") ) ( (= (cdr (assoc 2 D1)) "Tx Arial 1.65") (alert "Tx Arial 1.65 is selected") ) ( (= (cdr (assoc 2 D1)) "Tx CityBlueprint 2.38") (alert "Tx CityBlueprint 2.38 is selected") ) ); end cond ); end while (princ) ) Please help SAMPLE DIMENSION.dwg
  17. I am not even sure how to pose this question - so here she goes: I am not quite sure if you can select content with different colours within a text (see attachment). The code below only finds text colour selected by the layer. Is there a way? My whole intention is to sort them so that say if I pick BELL (colour 150) or RORGERS (colour 22) then the white text strings and colour 150 remains and the rest be removed - sorting by colour and merging the text condition the selection and colour!!! Possible? (setq ss (ssget "X" '((0 . "*TEXT")(62 . 1)))) if yes...how??? text sample.dwg
  18. I am trying to make this work but sometimes it works and sometimes does not. Please bare in mind that I just learned POLAR function and it may not the efficient way. The radius through fillet I am choosing sometimes works but sometimes comes up with an error that radius is too big. Is there another way to deal with drawing this or could there be a way to add arc without fillet? could someone also please explain the ssget function and how I can select any object i create and store under a variable? say, in this case I want to select all my lines: how would I do it? Please describe with some details so I can learn. Thanks ;; PROGRAM TO DRAW TOWER ANGLE WITH 60 DEG. ANGLE ;; (defun c:TANG (/ stpt totang thkang brkang r1 r2 si1 si2 S1 rad1) ; General questions (setq stpt (getpoint "\n Pick a point:") totang (getreal "\n Enter Angle Size:") thkang (getreal "\n Enter Angle Web Thickness:") brkang (getreal "\n Enter Break Distance:") ) ; calculate arc (setq r1 (/ thkang 2) r2 (* thkang 1) ) ; calculate polar coordinate ;(polar refpoint angle distance) (setq si1 (sin (angtof "7.5"))) (setq si2 (sin (angtof "82.5"))) (setq S1 (* (/ thkang si2) si1)) (setq p1 stpt p2 (polar p1 (angtof "90") brkang) p3 (polar p2 (angtof "105") (- totang brkang)) p4 (polar p3 (angtof "195") thkang) p5 (polar p4 (angtof "285") (- (- totang brkang) S1)) p6 (polar p5 (angtof "270") (- (- brkang thkang) S1)) p7 (polar p6 (angtof "180") (- (- brkang thkang) S1)) p8 (polar p7 (angtof "165") (- (- totang brkang) S1)) p9 (polar p8 (angtof "255") thkang) p10 (polar p9 (angtof "345") (- totang brkang)) p11 (polar p10 (angtof "0") brkang) ) ; to draw the lines (setq rad1 (* thkang 0.75)) (command "line" p1 p2 "") (command "line" p2 p3 "") (command "line" p3 p4 "") (command "line" p4 p5 "") (command "line" p5 p6 "") (command "line" p6 p7 "") (command "line" p7 p8 "") (command "line" p8 p9 "") (command "line" p9 p10"") (command "line" p10 p11 "") (command "fillet" "_R" r1) (command "fillet" p3 p4) (command "fillet" p8 p7) (command "fillet" "_R" rad1) (command "fillet" p6 p5) (princ) ) ;end defun
  19. Hey guys, I am trying to create a label (see attached dwg) using lisp to; upon entering the command: 1) ask for prefix then keep this prefix in memory (in this case BM-SC- let's say) 2) I would just enter the number associated with any block until i change my prefix 3) create a block with the criteria (dwg attached) and attributes so I can edit the text if need be 4) simply insert it on paperspace 5) also to auto adjust the box width so it remain a certain width but if it exceeds blah mm then to fit and center text within the maximum box size instead of extending the box. I do not know where to begin or how to handle this. Is it even possible with a lisp to accomplish all this? I do have this as a dynamic block but it seems to be a redundant task after a dozen paste - I have to fit the text or adjust the box. Thanks label.dwg
  20. Could someone guide me through this challenge: I am trying to create a lisp to have sub commands (I am not even sure what you would call it) - and when I search sub command I get a bunch of none sense. My first list is: [Bolt/U-bolt/Pipe/Angle/Plate/Hss-square] then under "Bolt": [1-2/5-8/3-4] under "U-bolt": [1-2/5-8] under "Pipe": [General/73/89/102/114] under "Angle": only on dynamic block with all sizes under "Plate": only on dynamic block with all sizes under "Hss-square": [Square/Rectangle] I have no idea how to make sub commands or how to call them in order to call insert command. all blocks are on the same dwg, but they have funky name that does not represent their shape only the size. so on this lisp: each time I select a "sub-menu" for the lack of better words, I then would like to insert the block. Example: Bolt > 5-8 > then magically insert "blah" block from its insertion point. (if(not ttc:Mode)(setq ttc:Mode "Pipe")) (initget "Bolt U-bolt Pipe Angle Plate Hss-square") (setq oldMode ttc:Mode ttc:Mode (getkword (strcat "\nSpecify mode [Bolt/U-bolt/Pipe/Angle/Plate/Hss-square] <" ttc:Mode ">: ")) conFlag T paseStr "" ); end setq (if(null ttc:Mode)(setq ttc:Mode oldMode)) Could someone help me with this please?
  21. What I am trying to accomplish would be two selection types: 1) what the default texts would be + a manual option and 2) where on the dimension the override to happen. I seem not to be able to successfully select one of the options under (initget "(Typ.) (TYpe.) (Plus-minus ±) Manual"): the manual is supposed to be for non default text. Can someone let me know what is wrong with this? This was my result before attempting to add the first option (initget "(Typ.) (TYpe.) (Plus-minus ±) Manual"). Please help! (defun c:dimch1 (/ Rtrn txt ss in vl) (progn (princ "\nSelect Dimension to modify: ") (setq ss (ssget "_:L" '((0 . "DIMENSION")))) ) ; START OF SELECTION FOR ADDING TEXT ON DIMENSIONS (progn (initget "(Typ.) (TYpe.) (Plus-minus ±) Manual") (setq Rtrn (cond ((getkword "\nType [(Typ.)/(TYpe.)/(Plus-minus ±)/Manual] <Manual>: " ) ) ("Manual") ) ) ) ;(if ;(and (setq Manual (/= (setq txt (getstring t "\n Specify the Text string :")) "" ;)) (progn (cond ((= Rtrn "(Typ.)") (setq Txt "(Typ.)")) ((= Rtrn "(TYpe.)") (setq Txt "(Type.)")) ((= Rtrn "(Plus-minus ±)") (setq Txt "± ")) ((= Rtrn "Manual") (setq Txt Txt)) ) ;end 2nd. condition (repeat (setq in (sslength ss)) (setq vl (vlax-ename->vla-object (ssname ss (setq in (1- in))))) (vl-catch-all-apply 'vla-put-TextOverride (list vl txt)) ) ) ; END OF SELECTION FOR ADDING TEXT ON DIMENSIONS (progn (initget "Above Below Prefix Suffix") (setq Rtrn (cond ((getkword "\nType [Above/Below/Prefix/Suffix] <Suffix>: " ) ) ("Suffix") ) ) ) ; end 1st. progn ;) ;end And (progn (cond ;((= Rtrn "Above") (setq Txt (strcat Txt "\\P<>"))) ;((= Rtrn "Below") (setq Txt (strcat "<>\\P" Txt))) ;((= Rtrn "Prefix") (setq Txt (strcat Txt " <>"))) ;((= Rtrn "Suffix") (setq Txt (strcat "<> " Txt))) ((= Rtrn "Above") (setq Txt (strcat "{\\fArial|b1|i0|c0|p34;" Txt "}" "\\P<>"))) ((= Rtrn "Below") (setq Txt (strcat "<>\\P" "{\\fArial|b1|i0|c0|p34;" Txt "}"))) ; replace it with <>\X{\fArial|b0|i0|c0|p34;(Type)} ((= Rtrn "Prefix") (setq Txt (strcat "{\\fArial|b1|i0|c0|p34;" Txt "}" " <>"))) ((= Rtrn "Suffix") (setq Txt (strcat "<> " "{\\fArial|b1|i0|c0|p34;" Txt "}"))) ) ;end 2nd. condition (repeat (setq in (sslength ss)) (setq vl (vlax-ename->vla-object (ssname ss (setq in (1- in))))) (vl-catch-all-apply 'vla-put-TextOverride (list vl txt)) ) ) ;end 2nd. progn ;) ; end if (princ) ) ;End Defun
  22. how do I get the first part to work? how do I combine the two? How do I have it so first pline is drawn/executed, followed by then (c2 command) measure command to insert specific block and then (c3 command) which is offset on both sides and delete original is executed? as you can see it looks so bad... please help (defun c:c2 (/ d1) (setq d1 (entget (car (entsel)))) (setq d2 (command "_.measure" "d1" "B" "Tx - Dalle béton + tapis" "Y" "1200" "")) ) (vl-load-com) (defun c:c3 ( / *error* of undo doc ss ) (defun *error* ( msg ) (and undo (vla-EndUndomark doc)) (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*") (princ (strcat "\n** Error: " msg " **"))) (princ)) (if (and (ssget '((0 . "ARC,CIRCLE,ELLIPSE,*LINE"))) (setq of (getdist "\nSpecify Offset Distance: "))) (progn (setq undo (not (vla-StartUndomark (setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))))) (vlax-for obj (setq ss (vla-get-ActiveSelectionSet doc)) (mapcar (function (lambda (o) (vl-catch-all-apply (function vla-offset) (list obj o)))) (list of (- of))) (vla-delete obj)) (setq undo (vla-EndUndoMark doc)))) (princ) )
  23. Could someone take a look at this lisp and let me know how I can get true north based on the North Symbol attached to remember my last pick so I can enter values as angle once the true north is set - I am thinking something like Offset command that keeps last entry if it is at all possible. Attached is the north symbol I am using on my projects but to orient antenna blocks to say 40 degrees from true north, then I have to go through selection process instead of value entry each time. Thanks (defun c:test (/ ss p1 oan nan rot) (princ "\n Select objects to Rotate: ")(terpri) (setq ss (ssget)) (setq p1 (getpoint "\n Center Point of Rotation: "))(terpri) (setq oan (getangle "\n Existing Angle Direction to be Corrected: "))(terpri) (setq nan (getangle "\n New Angle Direction: "))(terpri) (setq rot (/ (* (- nan oan) 180) pi)) (command "rotate" ss "" p1 rot) (princ) ) ;End Defun
  24. I did use STEAL lisp by MAC LEE before but since I am not inserting blocks anymore (Thousands of blocks on master general blocks), also because STEAL mess up the draw order on the hatch in dynamic blocks, is there a way: Upon entering a command to copy a selection coordinates from the source file and let user choose a place to paste them on the destination file; example: Cables <Enter> (go to D:/blocks/general blocks.dwg) and copy from specific coordinates and let me paste them to where I want on my current cad file? Thanks
  25. I have seen so many lisps to change the draw order or send hatch to back, but would there be a way to: My dynamic blocks are on layers 0 and defpoint; 1) upon inserting a dynamic block 2) preserve the block draw order or 3) send wipeout at the very back 4) Defpoint layer lines, plines, arc, circles before wipeout 5) Solid hatch before wipeout 6) Hatch ANSI32 & ANSI33 on top of Solid hatch 7) Text or dimension in Defpoint layer on top of solid hatch 8)All lines,plines, arcs, circles, etc at the very top if someone scrambles something I would really appreciate it.
  • Create New...