Jump to content

Would like to kno how to make command line open up !


CadFrank

Recommended Posts

Hi, i have a routine and i would like to add a action to it.

 

this routine is a dynamic block counter, the result of the count shows in the command prompt line so i would like to make this command prompt open at the end of the count.

 

This code was not created by me since im very new at autolisp.

I'm not sure if the autor is RenderMan but he is the one that gave it to me.

 

so here it is.

 

(defun c:BCD () (c:BlockCountDynamic))
(defun c:BlockCountDynamic  ( / ss item val valList)
 (vl-load-com)
 (princ "\rBLOCK COUNT: DYNAMIC ")
 ;|
(if (setq ss (ssget "_x"
                    (list '(0 . "INSERT")
                          '(2 . "*U*")                                ; <-This part of filter won't register for some reason?
                          (cons 410 (getvar 'ctab)))))
                          |;
 (if (setq ss (ssget "_x" (list '(0 . "INSERT")
                                (cons 410 (getvar 'ctab)))))
   (progn
     (vlax-for x  (setq ss (vla-get-activeselectionset
                             (vla-get-activedocument
                               (vlax-get-acad-object))))
       (if (and (= :vlax-true (vla-get-isdynamicblock x))
                (setq val
                       (vlax-get (car (vlax-invoke
                                        x
                                        'getdynamicblockproperties))
                                 'value)))
         (if (setq item (assoc val valList))
           (setq valList
                  (subst (cons val (1+ (cdr item))) item valList))
           (setq valList (cons (cons val 1) valList)))))
     (foreach item  (vl-sort valList
                             '(lambda (x y)
                                (< (car x) (car y))))
       (prompt
         (strcat "\n  >>  "
                 (car item)
                 " Total = "
                 (rtos (cdr item) 2 0))))
     (vla-delete ss))
   (prompt "\n** Nothing selected ** "))
 (princ))

 

Thanks for the help.

Link to comment
Share on other sites

well i'm not completly sure but i dont think it change much. But what i wanted exactly is to execute the f2 shortcut at the end of the count. AutoCad calls the window " autocad text window"

 

i can leave a picture of it might help understant what a want.

 

window.jpg

 

so here it is hope it will help understand what i want.

Link to comment
Share on other sites

paste that (textscr) on your command prompt and you shall see

 

or place (textscr) before the end of the last ")"

 

 
(prompt "\n** Nothing selected ** "))
 (princ)[color=blue](textscr)[/color]);<-----

 

and yes (2 . "`*U*") will work with the selection filter

 

I tested your code with the modificatiions and it works fine

Link to comment
Share on other sites

Hi, i have a routine and i would like to add a action to it.

 

this routine is a dynamic block counter, the result of the count shows in the command prompt line so i would like to make this command prompt open at the end of the count.

 

CadFrank - When you have a question about code provided you in another thread, your question would be best answered in the original thread.

 

This code was not created by me since im very new at autolisp.

I'm not sure if the autor is RenderMan but he is the one that gave it to me.

 

I (RenderMan) am the author of the code your question is in regards to.

 

To answer your question... Both (textscr), and (textpage) will open the AutoCAD Text Window (F2), and (graphscr) will return focus to the main application.

Link to comment
Share on other sites

Well it works so its all good ! i would like to know if you would know of any good books to learn autolisp that could help me understand the language.

Link to comment
Share on other sites

Sry i though it was to far in the list for people to see it since im new to forom i dont understand them yet but in the future i will.

Link to comment
Share on other sites

Sry i though it was to far in the list for people to see it since im new to forom i dont understand them yet but in the future i will.

 

No worries; Now you know...

 

knowing-is-half-the-battle.jpg

Link to comment
Share on other sites

I bought a book called "programmer autocad avec Diesel" its a french book since im french i was wondering if it was good.

Link to comment
Share on other sites

What is the diffence between visual lisp and autolisp?

 

That's a loaded question, but to try to answer you:

 

 

AutoLISP is a programming language designed for extending and customizing AutoCAD functionality. It is based on the LISP programming language, whose origins date back to the late 1950s. LISP was originally designed for use in Artificial Intelligence (AI) applications, and is still the basis for many AI applications.

 

AutoCAD introduced AutoLISP as an application programming interface (API) in Release 2.1, in the mid-1980s. LISP was chosen as the initial AutoCAD API because it was uniquely suited for the unstructured design process of AutoCAD projects, which involved repeatedly trying different solutions to design problems.

 

Visual LISP (VLISP) is a software tool designed to expedite AutoLISP program development. The VLISP integrated development environment (IDE) provides features to help ease the tasks of source-code creation and modification, program testing, and debugging. In addition, VLISP provides a vehicle for delivering standalone applications written in AutoLISP.

 

In the past, developing AutoLISP programs for AutoCAD meant supplying your own text editor for writing code, then loading the code into AutoCAD and running it. Debugging your program meant adding statements to print the contents of variables at strategic points in your program. You had to figure out where in your program to do this, and what variables you needed to look at. If you discovered you still didn't have enough information to determine the error, you had to go back and change the code again by adding more debugging points. And finally, when you got the program to work correctly, you needed to either comment out or remove the debugging code you added.

 

linky

Link to comment
Share on other sites

I bought a book called "programmer autocad avec Diesel" its a french book since im french i was wondering if it was good.

Je ne suis pas français, je ne sais donc pas, mon ami.

 

English: I am not French, so I do not know, my friend.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...