Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Publish CMDACTIVE

2 REPLIES 2
Reply
Message 1 of 3
jimmydee
640 Views, 2 Replies

Publish CMDACTIVE

I'm trying to figure out  a way to detect that the publish command is active while each drawing is being loaded, and I thought CMDACTIVE or CMDNAMES would do the trick, but it doesn't.

 

Here what's happening:

 

We have lot of custom stuff loading each time a drawing is loaded and sometimes an alert dialog is displayed, but I don't want the alert dialog to display if the publish command is active.

 

Any suggestions?

Thanks,

Jimmy

2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: jimmydee

The publish command is only called once so it can't be handled using the CMDACTIVE, so it isn't seen as an active command for the files opened after it has been excecuted. So you will need to create a reactor that watches for the command to be fired and establish a bulletin board variable to be passed to each file that is opened during the publish command.

 

To get a good starting point look at the following link:

 

See this thread.

 

Example code from thread ... as mentioned in the link you need to make sure this is loaded into all files. So you will need to add it to the startup routine or menu load file.

 

(vl-load-com)
;define function reactor for publish command start and end
(vlr-command-reactor
nil '((:vlr-commandWillStart . start-cmd)))
(vlr-command-reactor
nil '((:vlr-commandEnded . end-cmd)))

;publish command starts - set bulletin board variable to 1
(defun start-cmd (calling-reactor start-cmdInfo /
cmd-start)
(setq cmd-start (nth 0 start-cmdInfo))
(cond
((= cmd-start "PUBLISH") (vl-bb-set 'bb-Publish "1"))
);cond
(princ)
);defun

;publish command ends - call fc:cmd-Publish function
(defun end-cmd (calling-reactor end-cmdInfo /
cmd-end)
(setq cmd-end (nth 0 end-cmdInfo))
(cond
((= cmd-end "PUBLISH") (fc:cmd-Publish))
);cond
(princ)
);defun

;evaluate publish reactor on drawing open
;if value not equal to (1) one - load menu routines
;else quick open - none loaded
(if (/= (vl-bb-ref 'bb-Publish) "1")
(progn
(load "CFG-runonce.lsp") ;standard environment menu support
)
(progn
(print "Menu: NONE Loaded") ;publish environment quick open
)
)

;set bulletin board for standard file open
;when publish is called bulletin board is
;updated to run reactor on all files, reset on end
(defun fc:cmd-Publish ( / )
(vl-bb-set 'bb-Publish "0")
)

 

There are a couple of examples in the thread - the one above will cover the basics that you are looking for ...you can have it set to handle the dialog by simply skipping over all of the custom routines or split your load information up so it does a partial load.

 

Depending on how accessible the alert dialog boxes are you could add a simple call to verify whether the publish command is not active and fire the dialog box as shown below.

 

(if (/= (vl-bb-ref 'bb-Publish) "1")
(progn
(alert "Alert Box!") ;standard environment menu support
)
(progn
(print "No Alert") ;publish environment quick open
)
)

Rob

Message 3 of 3
jimmydee
in reply to: Anonymous

Rob,

 

Thank you for your response. It looks promising - I'll check it out.

 

Jimmy

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost