OpenDCL Forums

OpenDCL => Studio/Dialog Editor => Topic started by: andrew on December 09, 2009, 10:28:28 AM

Title: keeping the modeless box working in other dwgs
Post by: andrew on December 09, 2009, 10:28:28 AM
my project is a modeless box, i have a button that opens other dwgs.
is there another/better way to keep the box "working" or "loaded"  in other dwgs when they are opened via my project box, other then placing the lisp file call in my acaddoc.lsp
Title: Re: keeping the modeless box working in other dwgs
Post by: BazzaCAD on December 09, 2009, 10:45:39 AM
I think Kerry might be working on a tutorial on this topic.. (Kerry?)
In the meantime have a look at (vl-load-all) in the VLIDE help
Title: Re: keeping the modeless box working in other dwgs
Post by: andrew on December 09, 2009, 12:38:39 PM
Thanks

Ill keep a lookout for those tutorials

Title: Re: keeping the modeless box working in other dwgs
Post by: Kerry on December 09, 2009, 02:38:06 PM
I'm working on it when I have time ... burning candles both ends at the moment ..

but, I'm nibling away at it.
Title: Re: keeping the modeless box working in other dwgs
Post by: Fred Tomke on December 09, 2009, 11:38:53 PM
Shall I do it? I'd use (vl-load-all ...), too.

Fred
Title: Re: keeping the modeless box working in other dwgs
Post by: Kerry on December 10, 2009, 01:08:19 AM

Fred,
If you have or can make time, it would be great if you do it. :)

I'm learning palettes as I go 'because I've not programmed then before, so your first hand experience will help.

It's a big topic .... and bigger if we start looking at Seperate-Namespace VLX options ( which should be seperate tutorial )

I had thought that several small demo/tutorials would be best .. but your thoughts may differ.

Thanks
Kerry



Title: Re: keeping the modeless box working in other dwgs
Post by: Fred Tomke on December 10, 2009, 01:26:00 AM
Quote from: Kerry Brown on December 10, 2009, 01:08:19 AM
If you have or can make time, it would be great if you do it. :)

Can you keep a secret with you? I'm going to invent the 48-hours-day. I'm so close, but I afraid that I cannot make it!  :D

Seriously, because of the fact that I already use this I can easily copy and document it next night. I think it should be a easy solution just for understandig. The way the functionality is needed in each product is so specific, I'd prefer a simple solution - just like I would understand it.

I'm going to convert many old forms and even newer OpenDCL forms into palettes cause it's a great technology.
The start of the tutorial will be a ready palette which already works in the current drawing. I believe it would be the start of every palette form: make it happen in the current drawing and then manage it for the others.

I'd be glad to give the part of namespacing to anybody else because I do not understand this (yet). So I have the chance to extend my knowledge, too.

I think, andrew will sleep fitfully next night awaiting the tutorial  ;)

Fred
Title: Re: keeping the modeless box working in other dwgs
Post by: andrew on December 10, 2009, 06:06:50 AM
Quote from: Fred Tomke on December 10, 2009, 01:26:00 AM


I think, andrew will sleep fitfully next night awaiting the tutorial  ;)

Fred

hehe

anything to help the beginner odcl programer learn :)
Title: Re: keeping the modeless box working in other dwgs
Post by: Fred Tomke on December 11, 2009, 06:03:15 AM
Hi, Kerry and andrew, it took me a while. Please have a look here (http://www.opendcl.com/forum/index.php?topic=1073.0) and - please - improve my English!

Fred
Title: Re: keeping the modeless box working in other dwgs
Post by: BazzaCAD on December 11, 2009, 08:30:12 PM
Quote from: Fred Tomke on December 11, 2009, 06:03:15 AM
Hi, Kerry and andrew, it took me a while. Please have a look here (http://www.opendcl.com/forum/index.php?topic=1073.0) and - please - improve my English!

Fred

Amazing job Fred. Now I have to spend the next 2 hours reading this. :)
Title: Re: keeping the modeless box working in other dwgs
Post by: Kerry on December 11, 2009, 08:33:42 PM

Thanks Fred .. I have it bookmarked for reading too. :)
Title: Re: keeping the modeless box working in other dwgs
Post by: andrew on December 14, 2009, 06:04:04 AM
Thanks Fred,
I also have it bookmarked for reading.

Title: Re: keeping the modeless box working in other dwgs
Post by: andrew on December 18, 2009, 11:51:52 AM
Fred,
nice work on the write up for the modeless form aside from not being able to get the nodocstate function not working everything else works nicely

would you happen to have a trick to get a dwg that was opened via odcl to be the active document?
Title: Re: keeping the modeless box working in other dwgs
Post by: BazzaCAD on December 18, 2009, 01:13:50 PM
Quote from: andrew on December 18, 2009, 11:51:52 AM
would you happen to have a trick to get a dwg that was opened via odcl to be the active document?

Try something like this...
Code (autolisp) Select
(vla-Activate (vla-item (vla-get-documents (vlax-get-acad-object)) "MyDWG.dwg"))
Title: Re: keeping the modeless box working in other dwgs
Post by: andrew on December 21, 2009, 12:30:56 PM
Thanks Bazza for the reply

but i get an error with this
; error: Automation Error. Description was not provided.

i dont know what that means
do you know?


have a good holiday
Title: Re: keeping the modeless box working in other dwgs
Post by: Kerry on December 21, 2009, 12:57:02 PM

Andrew, what is the name of YOUR drawing. Did you use it in the statement ?

be sure to run (vl-load-com) before the statement to ensure that the ActiveX server is loaded.
Title: Re: keeping the modeless box working in other dwgs
Post by: andrew on December 22, 2009, 05:58:58 AM
Quote from: Kerry Brown on December 21, 2009, 12:57:02 PM

Andrew, what is the name of YOUR drawing. Did you use it in the statement ?

be sure to run (vl-load-com) before the statement to ensure that the ActiveX server is loaded.


(defun c:od-toolbox_Form2_BlockView1_OnDblClicked (/)
(if (Setq opfile (dcl_DWGList_GetFileName od-toolbox_Form1_DwgList1))
(vlax-invoke-method (vla-get-Documents (vlax-get-acad-object)) "Open" opfile)
        )
(vla-Activate (vla-item (vla-get-documents (vlax-get-acad-object)) opfile))
(princ)
)
Title: Re: keeping the modeless box working in other dwgs
Post by: Kerry on December 22, 2009, 02:05:02 PM
is opFile a fully qualified pathed fileName ??

This is WHY I asked about YOUR dwg Name.

The (vla-item on the Documents collection expects a document name NOT a qualified File Name.

ie
expects "abd.dwg"
not "C:/Folder/SubFolder/abc.dwg"


ALSO :
Note that once the document is Active the lisp you called from will no longer be in scope
( as it is run in the precious document namespace, not the newly active document)


Try these samples (2 different methods ) :


Code (autolisp) Select


(vl-load-com)
;;;------------------

(setq QualifiedFileName "J:/123-100")

;; assume Multi Document Interface

(setq oDoc (vlax-invoke-method (vla-get-Documents (vlax-get-acad-object)) "Open" QualifiedFileName))
(vla-Activate  oDoc)


;;;------------------

(setq QualifiedFileName "J:/123-101")

;; assume Multi Document Interface

(vlax-invoke-method (vla-get-Documents (vlax-get-acad-object)) "Open" QualifiedFileName)

(setq DocumentName (strcat (vl-filename-base QualifiedFileName) ".dwg"))

(vla-Activate (vla-item (vla-get-documents (vlax-get-acad-object)) DocumentName))

;; -> (setvar "clayer" "ST50") ;This will NOT run in newly active document

;;;------------------


Title: Re: keeping the modeless box working in other dwgs
Post by: BazzaCAD on December 22, 2009, 04:53:33 PM
I used to use a lot of the VLA-* function to try to open\close & set active DWG's, but it never worked very good.
Because like Kerry pointed out, once the DWG is opened, nothing after that can keep running.
Then I converted some of these functions to VBA, & you know how that went, no more VBA.
So Fred was kind enough to post some .NET code for me that's working great now.
http://www.opendcl.com/forum/index.php?topic=956.0 (http://www.opendcl.com/forum/index.php?topic=956.0)
Title: Re: keeping the modeless box working in other dwgs
Post by: andrew on December 23, 2009, 05:54:03 AM
Quote from: BazzaCAD on December 22, 2009, 04:53:33 PM
I used to use a lot of the VLA-* function to try to open\close & set active DWG's, but it never worked very good.
Because like Kerry pointed out, once the DWG is opened, nothing after that can keep running.
Then I converted some of these functions to VBA, & you know how that went, no more VBA.
So Fred was kind enough to post some .NET code for me that's working great now.
http://www.opendcl.com/forum/index.php?topic=956.0 (http://www.opendcl.com/forum/index.php?topic=956.0)

uggg one code language to learn at a time lol

thanks for the tip ill keep this in mind after i get more comfortable with odcl coding

happy holidays