.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How can I get "default" lineweight?

5 REPLIES 5
Reply
Message 1 of 6
KhademiH
641 Views, 5 Replies

How can I get "default" lineweight?

Hi all,

How can you get the "default" lineweight in RealDwg? As far as I know in RealDwg you cannot access to AutoCAD System Veriables (i.e. LWDEFAULT). In my case I have an entity, where:

 

entity.LineWeight returns "LineWeight.ByLineWeightDefault"

Database.Celweight returns "LineWeight.ByLayer"

layer.LineWeight returns "LineWeight.ByLineWeightDefault"

 

(I'm fallen into a loop!!!) when I open the DWG file in AutoCAD and run "lineweight" command, in the 'Lineweights Settings' dialog box I can see that the default is "0.25mm". This is what I need to get at in my program. I know that the system veriable "LWDEFAULT" give me "25" which is fair enough and I can convert it to LineWeight enum in my program, but the problem is I cannot find any way to get hold of that system variable.

Here I have been advised that "LWDEFAULT isn't a pre-drawing setting - it's stored in the Registry:"

HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R20.0\ACAD-E001:409\Profiles\<<unnamed profile="">>\General\LWDEFAULT

1. Firstly I'm not sure if this works all the time, suppose you develop an application and pass it to a user, where he/she hasn't got AutoCAD installed (i.e. you ship your app with RealDwg only). In this case the above-mentioned registry key will NOT be available on user's machine.

 

2. Secondly, digging out the registry entries just to get LWDEFAULT from seems to be utterly painful and over the top.

 

Many thanks for the help in advance.

Tags (2)
5 REPLIES 5
Message 2 of 6
Balaji_Ram
in reply to: KhademiH

Hello Hassan Khademi,

 

The default lineweight value is stored in the registry. 

AutoCAD stores this value under its “Profiles\Profile name\General” registry key as LWDEFAULT value. 

Other RealDwg host applications need to retrieve/store the LWDEFAULT value under their registry product root key. 

The “HostApplicationServices.GetEnvironmentVariable” virtual method can be overridden in your RealDwg application to provide access to the 
system variable. This is similar to what AutoCAD does with its “Application.GetEnvironmentVariable” 

 

Regards,

Balaji



Balaji
Developer Technical Services
Autodesk Developer Network

Message 3 of 6
KhademiH
in reply to: Balaji_Ram

Hi Balaji,

So the only way is to dig it out of the registry 😞 .

however I'm still confused how it works when a file is accessed from another machine. Suppose on Computer_1, I have setup the default lineWeight to 0.25mm and created a DWG file. On Computer_2 I have setup the default lineweight to 0.50mm. If I read the file in Computer_2, what do I get as the default lineWeight? 0.25mm or 0.50mm?

Obviousely I need to get  0.25mm in this case, because I need to get access to the settings on the original file rather than the settings on my owm machine.

 

p.s. In my posts (our conversations) I would rather to be called "KhademiH" rather than my full name. Thanks for understading this.

Message 4 of 6
Balaji_Ram
in reply to: KhademiH

Sorry for the delay. I had to attend to some other tasks.

 

Also, sorry about using your full name. I could not edit the reply because it has timed out.

 

In the example that you mentioned, if the drawing is taken to another system that has a LWDEFAULT set to 0.5 mm, I would expect the line weight to display as 0.5 mm and not using the original LWDEFAULT value of 0.25 mm. 

 

To get the behavior that you mention, you will need to set the current lineweight.  In that case, the lineweight is a database property and can be accessed using the "Database.Celweight".

 

Regards,

Balaji

 

 

 

 



Balaji
Developer Technical Services
Autodesk Developer Network

Message 5 of 6
KhademiH
in reply to: Balaji_Ram

Hi Balaji,

This behaviour has caused a lot of grief here. And I'm talikng about thousands of entities within hunderds of charts which we have in every single project that we do. This is what happens:

 

  • In our Drawing Office, the cartographers set the default lineweight on their machine to a value of their choice. They choose the default lineweight based on the frequency, by which I mean if the majoirty of entites in their drawing would have a lineweight of e.g. 0.25, they would set the default to LW25, if the majority of lineweights are 0.5 they would set the default to LW50 for example. Obviousely to minimize the production time.
  • Whithin the in-house RealDwg app that we have developed here, we take the lineweight of entties and interperete it as e.g. PenWidth and use them in our publishing software .
  • In our Data-Processing Office, the data processors run our app and analyze the data. They might either have AutoCAD installed on their machines, while many of them even doesn't have AutoCAD installed on their machine at all.
  • The important thing is that data-processors should not modify the files they receive at all. That's why many of them even don't have AutoCAD installed on their machines at all.
  • We cannot dictate the cartographers to use a certain default lineweight, because it can potentially increase their workload and therefore delay the production. In some cases we use the historical DWG files too, which have no control over them at all - i.e. no cartographer to talk to

 

 In fact I seem to have no fix for the problem and it seems to be my fault as I didn't design our app correctly in first place due to my wrong assumptions about "Lineweight"(s) in AutoCAD 😞

Message 6 of 6
Balaji_Ram
in reply to: KhademiH

I am sorry to hear that and not being able to help. Smiley Sad

 

 



Balaji
Developer Technical Services
Autodesk Developer Network

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost