Is there a way to get the scale of a closed drawing?

Started by flwright, June 30, 2011, 02:21:47 PM

Previous topic - Next topic

flwright

This is something I have been after for quite some time, but my search continuously leads me to dead ends.

I am attempting to create a dialog box which lists all drawings in a given directory.  The user can select a drawing from the listbox and then the drawing will attach as an xref into the current drawing.  The difficult part is that I would like the xref to be scaled according to the cannoscale of the attaching drawing.

Does anybody know of a way to accomplish this?

Thank you,
Jeffrey K. Ries
Novi, MI

Fred Tomke

Hello, and welcome to this board. I had a quick try but I didn't find where AutoCAD stores the value of CANNOSCALE of ModelSpace. But post your question to http://www.theswamp.org because OpenDCL forum is a specific forum OpebDCL related questions.

Regards, Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

flwright

Thank you for the response and the warm welcome.

I understand this forum is specific to just OpenDCL, but I posed the same question at Autodesk's forums and had no luck.

I know there are other forums to try such as the Swamp and AUGI, but I believe I will have similar results there as well.  I believe this because most other forums are divided by programming language which doesn't necessarily help me because I only know lisp.  And after much research I am fairly certain it cannot be done with lisp.

I am asking the question here because I believe the contributors here are similar to myself in that we are trying to reach similar goals - customizing AutoCAD to do specific and extraordinary things.  My hope is that someone here has already accomplished what I am attempting because they have done it in a different programming language in which it is possible.  That could at least point me in the right direction.

I understand that this may go unanswered as it did on Autodesk's forums, but I have to at least try.

Jeffrey K. Ries
Novi, MI


Fred Tomke

Hi, flwright, sorry that I had no idea. I tried to save the drawing into dxf. Then I used ArxDbgSnoobDb to research the drawing for the handle of the scale object I've choosen before - but I didn't find it yet. But I recommend you to do this, too. I didn't search for the name, but only for the handle. LayerTableRecords are linked by their names. Maybe the scales are doing it as well.

Regards, Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

jbuzbee

ObjectDBX perhaps?

Search at theSwamp.org for ObjectDBX functions (this is an AutoLISP exposed API).

Fred Tomke

Hi, James, thanks. But to do this we need to know at first where AutoCAD stores the information of active annotation scale before we start loading the drawing via ObjectDBX.
I had a research but I didn't find it. May be you find the key, James.

Regards, Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]


flwright

ObjectDBX is an excellent suggestion, it seems the most likely to my project.

However, I tried it and found that while it is capable of pulling certain info from a closed drawing it will not work with variables.

jbuzbee - I did try vla-getvariable.  It seemed to work (it produced a scale reference for me) and I went ahead and created the dialog and commands necessary for my project.  Once done I tested and realized that the scale reference I was receiving was that of the sheet file I was currently in and not the detail file I was trying to probe.

Fred Tomke - the info I am trying to get is stored as a variable within modelspace called 'cannoscale' or 'cannoscalevalue'.  Is that what you mean?

If all else fails I plan to use ObjectDBX in conjunction with a custom dictionary.  The down side of this is that it will only pull the data from files in which the user has already placed the data (of course).  I can automate this data placement, but we have a large number of existing drawings.  This would put me in a position of creating a function which works most of the time.

Does OpenDCL work with .NET?  I am told that it may have this ability to pull variables from a closed drawing.

Fred Tomke

Hello,

Quote from: flwright on July 05, 2011, 08:37:29 AM
Fred Tomke - the info I am trying to get is stored as a variable within modelspace called 'cannoscale' or 'cannoscalevalue'.  Is that what you mean?
Yes, the current scale is stored in the systemvariable 'cannoscale'. But drawing-depended systemvariables only work for the current drawing. As far as I know you can't get systemvariables from the drawing opened by ObjectDBX:
; Applicable Methods:
;   CopyObjects (3)
;   DxfIn (2)
;   DxfOut (3)
;   HandleToObject (1)
;   ObjectIdToObject (1)
;   ObjectIdToObject32 (1)
;   Open (2)
;   Save ()
;   SaveAs (2)

Since scale objects are named objects like layouts I've tried to find the correct named object for the current scale. All settings must be stored in the drawing to make it available when drawing will be loaded. So I tried to find the place where AutoCAD stores the data you need.

Quote from: flwright on July 05, 2011, 08:37:29 AM
Does OpenDCL work with .NET?  I am told that it may have this ability to pull variables from a closed drawing.

You can create a lisp functionin .NET to read out the scale from a closed drawing to return it into lisp and to show the result in an OpenDCL form.

Regards, Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]