I have a situation where I open AutoCAD programmatically and the starts inserting blocks. However, when my application opens AutoCAD the blocks come in with the wrong LTScale. Here's what's puzzling, when I first open AutoCAD and then my application [the application uses GetObject in this second scenario] the blocks then come in with the correct LTScale. Does anyone know what could possibly be going on here. I'm really at a loss for an explanation. TIA. Joe --
This will probably be a stupid question, but have checked the CELTSCALE variable's value before and after the insert in both scenarios? If so, what were the results? As for a solution.............if you're only trying to apply the current style, why not just do so after inserting it? eIns = ThisDrawing.ModelSpace.AddInsert eIns.LinetypeScale = ThisDrawing.GetVariable("CELTSCALE") .......please forgive any typos in that (and also for assuming that you hadn't considered doing this)
Tom, I'm afraid I didn't do a good job of explaining myself. When I first open a drawing from scratch using the Metric option and then run my application to inserts blocks the LTScale of the blocks is correct. However, if I open a session of AutoCAD through code and insert the same blocks my LTScales are all wrong. Hence, the question is really how do I start a session of AutoCAD with the same metric option I use when open a drawing through AutoCAD? Joe --
Forgive my ingorance, Joe, but what is the 'metric option'? BTW: In case you didn't get my other message, using SendKeys to pass "{ENTER}" was an acceptable workaround to the SendCommand crashing with the vbCr.
Tom, When you have Preferences set to Show traditional startup dialog" you can choose between Inch or Metric when starting from stratch. Joe --
I don't use the startup dialog, but I was under the impression that it was little more than a 'wizard' type interface to different prototype drawings. Is it possible that you have a screwy prototype drawing?
Unfortunately, I have found that through various methods, nothing works consistently. Sometimes the blocks come in correctly, sometimes they don't. There does not seem to be a clear method of guaranteeing the blocks will come in correctly everytime. However, thanks so much for the help. Glad you got your other problem fixed. Joe --
If you'd like me to try anything for you, let me know. I'd be happy to help. Sorry I couldn't offer you more help.
Are you opening a drawing or inserting blocks into the default drawing? If the latter, have you tried the Add method of the AcadDocuments class? It'll allow you to specify a template.
Frank, Yep, tried that too. Sometimes it works, sometimes it don't. It's really strange cause if I open the blocks like a drawing, the LTScales are fine. And, it's not all the blocks just some of them. Joe --
Joe, You might want to check the "MEASUREMENT" variable (command) to see if you are actually getting a metric drawing when you start programmatically. value of 0 is an English drawing value of 1 is a metric drawing Paul