Jump to content

Recommended Posts

Posted

Hi everyone!

 

I need help.

Here is my problem:

I want to write a lisp program that loads automatically a menu file (mns) and runs 2 macros.

And I want to modify also the Support File Search Path.

Could anyone help my out, please!

 

Thanks for any answers!

Best regards

  • Replies 32
  • Created
  • Last Reply

Top Posters In This Topic

  • hunszab

    16

  • Tharwat

    7

  • Lee Mac

    6

  • The Buzzard

    3

Posted

Hi

 

What are the actions of macros you want to implement ?

 

If you want to change the Support file you can do that from Autocad Options in the first tab..

 

Regards

 

Tharwat

Posted

Hi!

Here is my problem:

The users will use my program (my functions and menu) so I have to do everything automatically, because most users dont know how to modify the support file search path.

So That's why I need to know how can I modify the support file path programmatically and how can I run macros. Because if the user options is that: macros disabled, the macros wont run automatically :(

 

Regards

Posted
Hi!

Here is my problem:

The users will use my program (my functions and menu) so I have to do everything automatically, because most users dont know how to modify the support file search path.

So That's why I need to know how can I modify the support file path programmatically and how can I run macros. Because if the user options is that: macros disabled, the macros wont run automatically :(

 

Regards

 

For Macros, open CUI then make a new command and post your codes in the macro tag and don't forget to add this new command to your menu .

 

What you want to change in Support file ????

 

Regards

 

Tharwat

Posted

Hi

 

Thanks, but I dont know how to write a macro that runs another macro...

For example: I made the menu, just need the command to run "mymacro".

What will be the command?

^C^C( run "mymacro") or what ?

Where can I find some information about writing macros?

 

Thanks

 

Regards

 

For Macros, open CUI then make a new command and post your codes in the macro tag and don't forget to add this new command to your menu .

 

What you want to change in Support file ????

 

Regards

 

Tharwat

Posted
Hi!

Here is my problem:

The users will use my program (my functions and menu) so I have to do everything automatically, because most users dont know how to modify the support file search path.

So That's why I need to know how can I modify the support file path programmatically and how can I run macros. Because if the user options is that: macros disabled, the macros wont run automatically :(

 

Regards

 

 

See this link on Afralisp, It will show you how:http://www.afralisp.net/archive/lisp/install1.htm

Posted
Hi

Thanks, but I dont know how to write a macro that runs another macro...

For example: I made the menu, just need the command to run "mymacro".

What will be the command?

^C^C( run "mymacro") or what ?

Where can I find some information about writing macros?

Thanks

Regards

I have asked before what kind of action do you want to perform?

And according to what you have mentioned, it shows that you are well known with programing which would make something to beginners to follow !!!!!

 

Write what you want clearly and directly, and that's would be good for all and for your gain aims of them .

 

Regards

 

Tharwat

Posted

Ok, I try to write my problem down clearly:

 

That's a program what is completely working, but the user must do many things to work. (ok, most things just once as an option, first time)

 

1) He/She has to modify the Support File Path

(if is possible I want to do it programatticaly, I have found a command: addsupportfilepath but doesnt work)

 

2) In the AutoCad file (.dwg) there are 2 macro. It has to be runned.

Normally when somebody opens a dwg file that contains macros the system ask the user if he wants to run it. My problem is, maybe the user clicks NO, or the system doesnt ask he, and he forgets to run the macros...

So I have to run the 2 macros.

I ve allready solved this.

I wrote a function:

(command "-vbarun" "mymacro.whatever"):)

 

I ask: when I run my function -so in the function -, can I determ if the macro was found and successfully runned?

(of course in the command line I see, if something happend: BUT user is stupid and he/she doesnt)

 

I want to make a menu, where the user just has to click and the program makes these things (support file, run macros).

The menu is done.

 

I think that's all.

I hope now the problem is clear.:)

 

I wait the responds!

 

regards

 

I have asked before what kind of action do you want to perform?

And according to what you have mentioned, it shows that you are well known with programing which would make something to beginners to follow !!!!!

 

Write what you want clearly and directly, and that's would be good for all and for your gain aims of them .

 

Regards

 

Tharwat

Posted

I forget to say: I want to determine if the user disabled the macros, and if did, I want to enable it. IS it possible from a lisp function?

Posted
(defun LM:AddSupportPaths ( lst / PreferenceFiles SupportPaths )
 ;; © Lee Mac  ~  14.06.10
 ;; (AddSupportPaths '("C:\\Folder" "C:\\Folder\\Subfolder" ... )
 (vl-load-com)

 (setq SupportPaths
   (vla-get-SupportPath
     (setq PreferenceFiles
       (vla-get-files
         (vla-get-preferences
           (vlax-get-acad-object)
         )
       )
     )
   )
 )

 (vla-put-SupportPath PreferenceFiles
   (LM:lst->str
     (cons SupportPaths
       (vl-remove-if
         (function
           (lambda ( s )
             (vl-string-search s SupportPaths)
           )
         )
         lst
       )
     )
     ";"
   )
 )
 lst
)

(defun LM:RemoveSupportPaths ( lst / PreferenceFiles SupportPaths )
 ;; © Lee Mac  ~  14.06.10
 ;; (RemoveSupportPaths '("C:\\Folder" "C:\\Folder\\Subfolder" ... )
 (vl-load-com)

 (setq SupportPaths
   (vla-get-SupportPath
     (setq PreferenceFiles
       (vla-get-files
         (vla-get-preferences
           (vlax-get-acad-object)
         )
       )
     )
   )
 )

 (vla-put-SupportPath PreferenceFiles
   (LM:lst->str
     (vl-remove-if
       (function
         (lambda ( s )
           (vl-position s lst)
         )
       )
       (LM:StringParser SupportPaths ";")
     )
     ";"
   )
 )
 lst
)

(defun LM:lst->str ( lst del )
 ;; © Lee Mac  ~  14.06.10
 (if (cdr lst)
   (strcat (car lst) del (LM:lst->str (cdr lst) del))
   (car lst)
 )
)

(defun LM:StringParser ( str del )
 ;; © Lee Mac  ~  14.06.10
 (if (setq pos (vl-string-search del str))
   (cons (substr str 1 pos)
         (LM:StringParser (substr str (+ pos 1 (strlen del))) del))
   (list str)
 )
)

Posted

Thanks a lot.

 

My last question is: Can I determine if the macros are enable or not?

ANd if not can I enable it?

 

Thanks

Posted

to macros!

 

Because if the user disabled the macros I need to enable it and run them.

So I have to determine if the macros are disabled or not.

 

Are you referring to toolbar macros or LISP files?
  • 2 weeks later...
Posted

Hi everyone!

 

I have the following problem:

 

I have a menu (DCL) with a popup_list.

I want to do: when the menu starts i.e. the 3rd item must be selected, and not the default 1st.

 

Thanks any help!

Posted

You could do this in the dcl.

 

: popup_list { key = "key"; value = "3"; }

Posted
to macros!

 

Because if the user disabled the macros I need to enable it and run them.

So I have to determine if the macros are disabled or not.

just thinking out loud here - once I have disabled macros I want them disabled, I don't want something to come along and change that for me. Am I being unreasonable?
Posted

Normally you are right!

BUT: the AUTOCAD drawing is connected with MYSQL database, so macros must be enabled, otherwise the whole story wont work, and the user just blink...."why these stupid program doesn't work" :)

 

@The Buzzard: thanks a lot, and can I do it dinamically for example with a variable?

Posted
Normally you are right!

BUT: the AUTOCAD drawing is connected with MYSQL database, so macros must be enabled, otherwise the whole story wont work, and the user just blink...."why these stupid program doesn't work" :)

 

@The Buzzard: thanks a lot, and can I do it dinamically for example with a variable?

 

Using a variable is not a problem, But I did not show an example for this because I do not know how you wrote your action_tiles in your code.

If you can post it, I can recomend something.

Posted

Thanks a lot!

I've already solved the problem.

Posted (edited)

Hi all!

 

How can I select every object that is in a specific point?

To be more specific... I have blocks, so they have just one point. And I want to select a block that point is i.e. (0,0) or (x,y).

So how can I do that?

 

Thanks any help

Edited by hunszab

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...