Scale of a Model Space with vba

Scale of a Model Space with vba

Anonymous
Not applicable
2,335 Views
3 Replies
Message 1 of 4

Scale of a Model Space with vba

Anonymous
Not applicable

In my company I receive Autocad drawings from another department. They are exported from Inventor.

In this drawings everything is only in ModelSpace - PaperSpace is void.

Believe it or not, but this drawings do not have scale on them. I try to find out this scale using VBA.

So I managed to find properties of the frame in drawing (name of this frame is "Ramki ZREW") and it turns out that VBA sees different size of elements than I see on a drawing.

In attachment you can see a drawing with dimensioned frame and screen of vba locals window. This frame consists only of 4 lines so it is easy to compare. As you can see, I have length of 200 in vba and 4000 in autocad . The other dimension in vba is 287 and in autocad it is 5740 - so the scale of drawing is presumably 20.

The same goes to all entities such as TitleBlock elements. With vba I can only get the "starting value" and not the real value in Autocad drawing.

Of course all scaling factors in dimension styles are set to 1.

 

I think that there is a ModelSpace scale but I am unable to find it with vba.

 

Can you help?

sc02.pngsc01.png

 

 

0 Likes
Accepted solutions (2)
2,336 Views
3 Replies
Replies (3)
Message 2 of 4

Ed__Jobe
Mentor
Mentor

Can you post a copy of the dwg?

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 3 of 4

grobnik
Collaborator
Collaborator
Accepted solution

Hi @Anonymous probably I do not understand well the request, but inside the picture you shared, on selected object properties, there are indication of scaling factor of 20 on X, Y, and Z. So you do not need to calculate object it's already scaled of 20 factor.

If you want you can insert inside paperspace your titleblock not scaled, and scale the viewport window of 1/20.

 

In any case as @Ed__Jobe suggested it's better to have a DWG.

 

Regards

Message 4 of 4

Anonymous
Not applicable
Accepted solution

You are right - the scaling factor (that I search for) is inside the drawing, but I could not access it through VBA.

I thought that the whole ModelSpace is scaled, but after your post I fugured out, that only the blocks are scaled (all with the same factor).

 

My mistake was that I searched with ActiveDocument.Blocks - there are only block definitions, so there can be no scale.

When I search with ActiveDocument.ModelSpace (as in attachment), I found this blocks with scale factors.

 

So now this scale factors are easy to get.

 

Thanks for your advice - case is solved.

 

sc03.png