Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/30/2022 in all areas

  1. Progress bars are built in as a Acet command. One example. Moving away from using (command and using (entmake speeds up processing immensly but like mhupp changing 1000+ objects 4 times takes like 2 minutes compared to say 4 hours. Still working on progress bar a cheats way something is happening is (princ x) then add 1 to x so see 12345................ ;; EXAMPLE LISP SHORT VERSION (defun c:test(/ progress) (defun progressbar (a b c d) (cond ((= 0 a) (acet-ui-progress-init d 100) (setq c 0) ) ((= 1 a) (setq c (+ (/ 100.0 b) c)) (acet-ui-progress-safe c) ) ((= 2 a) (acet-ui-progress-done) ) ) c ) (setq repeatvariable 10000) (setq progress (Progressbar 0 repeatvariable progress "Processing:")) ;Create the progress bar, total length is repeatvariable or 10000 (repeat repeatvariable (setq progress (Progressbar 1 repeatvariable progress "")) ;arg (a) is set to 1 and (d) can be blank here ;code to repeat in here ) (Progressbar 2 0 0 "") ;arg(a) is set to 2 to close the progress bar, arg (b), (c) & (d) can be blanks )
    2 points
  2. Thank you very much Steven P.
    1 point
  3. Just as a learning point, this is common I think that there is a confusion between (list and '( Both create lists. Look online for the differences in making up lists but hopefully below will give you something to think about. Anything after '( is a fixed list, CAD won't evaluate anything in that list Anything after (list and CAD can evaluate anything in that list For example '( 1 2 3 4 5) is OK, the list is (1 2 3 4 5) '( (cons 1 2) 3 4 5) does not make a list '( (1 2) 3 4 5), the list is as typed ( (cons 1 2) 3 4 5) (and will be an error since 'cons' will be seen as a string, wanting it written as "cons") (list 1 2 3 4 5) is also OK, the list is also (1 2 3 4 5) (list (cons 1 2) 3 4 5) will make the list ( (1 2) 3 4 5), the (cons 1 2) is worked out to make a list (1 2) and used in the list looking at your example (ssget "X" (list '((-4 . "&=")(62 . 250) (cons 410 tab))))) (list .....) will evaluate what is after that, and then the next characters '(.... will create a fixed list, as it is typed, the (cons 410 tab) will not be calculated and in fact, will be an error since the '(.... wants that written out as ("cons" 410 "tab"). It is wanting (ssget "X" (list '((-4 . "&=")(62 . 250) ("cons" 410 "tab"))))) - noting the " Changing it about, make the '(... into (list....., CAD also likes list items to be specified as list items, often wanting what is in the list to have a '(, a (list, or a (cons before each item the next problem is that the lists (eg (-4 . "&=") ) creating your list need to be specified as lists, put a ' before them, use cons or list to create a list Which gives this, and that does what you want I think (ssget "X" (list '(-4 . "&=") '(62 . 250) (cons 410 tab) )) (foreach tab (layoutlist) (setvar 'CTAB tab) (if (setq clr (ssget "X" (list '(-4 . "&=") '(62 . 250) (cons 410 tab) )) ) (command "CHPROP" clr "" "C" 7 "") ) ; end if ) ;end foreach and just to emphasise a point you can also do this like this (foreach tab (layoutlist) (setvar 'CTAB tab) (if (setq clr (ssget "X" (list (cons -4 "&=") (cons 62 250) (cons 410 tab) )) ) (command "CHPROP" clr "" "C" 7 "") ) ; end if ) ;end foreach
    1 point
  4. Her is very basic start which might give you ideas to get you going. Most of us started with something very simple, my goals are always to reduce the number of key presses or to improve consistency or speed of drawing. If you have written anything and want to ask about it, you can post the code in your question but press the code tag button above (it is the one in the text box here with '<>' - highlights the text as a code.. see below Open a text editor - going from first principles is the best way to learn the basics. Now save it as you want but save with a '.lsp' extension instead of say '.txt. Next define a LISP in that, you can copy this: (defun c:MyTestLisp ( / ) ) 'defun' is the thing that starts the definition. It has an opening bracket, ( and rhere needs to be a closing bracket to tell CAD where that command ends (always have pairs of brackets), So put a closing bracket right at the end of the LISP 'c:' tells the CAD that you can run this command from the command line. Some LISPs don't have this and some have others but if you want to run this directly put in the C MyTestLisp is your LISP name, this is the word you use to run it. Since it has a 'C:' in front just type that word in the command line and it will work. ( / ) is where you can define variables - always a good idea to define any you use here. Anything before the / are variables that are passed to the LISP at the start... can look at that another time, anything after local variables that only this LISP will use. If you dn't define a variable here it becomes global and that mens any LISP can use it... but if you don't expect that it can cause odd results, local variables are better. Right, save this, go to appload, and load it. Type MyTestLisp in the cokmand line and it runs. Does nothing yet but no error messages. First LISP I did was 'ZA', you might have a go put in this (commamnd "Zoom" "all") (command tells the LISP that you are using a CAD command, "..." are the inputs you would put into that command. Replace the LISP name with ZA, save, appload and so on, type in ZA and your drawing should zoom all, with 2 button presses instead of "zoom all", 8 buttons. First LISP made, have a go, get that to work, learn the process to get it working in CAD and then think about what you want to do
    1 point
  5. Create and save your LAYER SNAPSHOTS through each of your ACTIVE VIEWPORTS, one at a time, instead of in MODELSPACE.
    1 point
  6. In a viewport you use VPLAYER, viewport layer. Just go to the layer display and scroll across to the right and you will see viewport settings for layers you can freeze a layer Vpfreeze even change its color. So turn on all layers in model and use the freeze option, a manual way is VPLAYER.
    1 point
  7. Command CCL, for Change Color Layouts. I commented out the command that sets the active layout. Put it back if you really want. The main thing is entmod (modify entities by adding or changing the data group). Obviously don't take my layoutlist function. ;; dummy function just for my simple test. You have your own (defun layoutlist ( / ) (list "Layout1" "Layout2" "Layout3" ) ) (defun c:ccl ( / tab i clr ent col) (setq col 7) ;; destination color (foreach tab (layoutlist) ;; you don't need to set the layout active. You can if you really want ;; (setvar 'CTAB tab) (if (setq clr (ssget "X" (list (cons 62 250) (cons 410 tab)) )) (progn (setq i 0) (repeat (sslength clr) (setq ent (ssname clr i)) ;; modify color (if (assoc 62 (entget ent)) (entmod (subst (cons 62 col) (assoc 62 (entget ent)) (entget ent) )) ;; substitute color (entmod (append (entget ent) (list (cons 62 col) ) )) ;; add color ) (setq i (+ i 1)) ) )) ) )
    1 point
×
×
  • Create New...