Open dwg file - error

Started by juniorolisp, February 12, 2015, 01:13:24 PM

Previous topic - Next topic

juniorolisp

After a week of testing I find that everything works great.
There were, however, a new question:
How to open file "Read-only" (or is it at all possible?)?

owenwengerd

One way to force a file to open read-only is to open it for writing with the lisp expression (open "<filepath>" "a") before issuing the OPEN command. I don't know how that will work in your scenario.

juniorolisp

Hello,
After long trials, there was another problem.
If you open the file will get the message
QuoteThis file is already in use. Do you want to open it as read-only?
and click no.
All functions lisp stop working. Do you have any idea how to get around \ repair

roy_043

I think you will need to give more details.
If you open a dwg as read-only you can still run Lisp code in that drawing.

juniorolisp

so then it works.
It stops working when you give up opening the file

roy_043

After many tests I find the problem is related to the undocked state of the palette. If the palette is docked before any double click action has occurred, things seem to work fine. In BricsCAD V14 this problem does not occur but even in that version there are still issues with palettes.

juniorolisp

Do you have maybe an idea how to bypass this problem? Is the only solution is to update to a higher version of Bricscad?

roy_043

I have tried 3 alternative methods, but can't find a full proof approach to opening the drawings.

Method 1 can't be used because on_doc_load.lsp and .mnl files are not loaded in the new drawings.
Methods 2 and 3 suffer from the problem mentioned in posts #2 and #7. I think this problem is caused by a 'namespace issue'. The ODCL dialog is using functions that are defined in a different drawing from the current one. In my tests closing a drawing (after creating some entities) seems to be a trigger.

Note 1: BricsCAD V13 and ODCL 8.0.0.6 were used for testing.
Note 2: I have created a new ODCL project with a modeless dialog and have used the new 'dcl-' naming scheme.

Method 1: I_new_vla-open.lsp
Use (vla-open) to open drawings.
This is a strange one! In my tests I have used on_doc_load.lsp to load the project Lisp file. And even thought on_doc_load.lsp is not loaded in a dwg opened with (vla-open), the ODCL dialog works fine in the new drawing. This again points to a namespace issue.

Method 2: I_new_script.lsp
Use a temporary script to open drawings.

Method 3: I_new_sendkeys.lsp
Use the WSH sendkeys method to open drawings.

owenwengerd

Roy, there was a bugfix in one of the BricsCAD V15 updates that addresses the problem with functions not being defined in the correct namespace.

roy_043

Quote from: owenwengerd on August 09, 2015, 04:43:45 PM
Roy, there was a bugfix in one of the BricsCAD V15 updates that addresses the problem with functions not being defined in the correct namespace.
I am using BricsCAD V14 at the moment. But good to know it has been fixed. Thanks.