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

How to set variable in c#?

2 REPLIES 2
Reply
Message 1 of 3
prakasht66
2492 Views, 2 Replies

How to set variable in c#?

Hi im Currently working on c# automation.Since im using autocad interop im not able to understand the process of setting

variable in autocad..I have drawing files with different dimensionstyles used inside..I can filter the dimesion by selectionset.but the problem is im filterring through dimstyle name.Is there any dxf code for selecting all kind of dimension styles.So that it will be useful for me.Im completely new to to Autocad,.

 

But my problem is i need to apply one particular standard dimstyle to all my drawings..Can someone help how i could set variable to my new dimstyle(new).this is my code for setting variable ,but its not updating in my current document.

 

this is my code;

 

double a = Convert.ToDouble((acadDocument.GetVariable("DIMASZ")));

 

object b = Convert.ToDouble(2.5);

acadDocument.SetVariable(

"DIMASZ", b);

2 REPLIES 2
Message 2 of 3
prakasht66
in reply to: prakasht66

I found the answer.i can simply set the variable by using this

acadDocument.Setvariable("DIMASZ",1.5);

but is it possible to apply these properties to my newly created dimensionstyle. give me a suggestion...Thanks in advance

Message 3 of 3
norman.yuan
in reply to: prakasht66

Firstly, some comments not directly answers your question here, but I thought it is important for you to know, seeing your other post.

 

It is not important that you use C# or VB.NET to do your code. Rather it is very important for beginner to know which AutoCAD programming API is used. In this forum, (and most AutoCAD custom programmers are doing) it is ObjectARX .NET API.

 

With the few lines of code you showed here, obviously, you are using COM API, which is often the topic in the "Visual Basic Customization forum, even you use C#. It is OK to ask COM API question here, a long as you know what you are using.

 

Back to your question.

 

Setting "DIMxxxx" system variable does not change DimStyles defined in current document. It only create document overrides, which works with current ActiveDimStyle together to present dimension in the current drawing. If you want to persist the changes made through setting system variables "DIMxxxx", you need to call AcadDimStyle.CopyFrom() method with ThisDrawing as source, be it the active dimstyle, or a dimstyle you just created.

 

Norman Yuan

Drive CAD With Code

EESignature

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