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

Issue with INSNAME.

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
RamanSBV
448 Views, 4 Replies

Issue with INSNAME.

Hi,

 

We are unable to set the value for system variable "INSNAME" .

It is returning nothing after assigning values for this variable.

 

We are using below statement for setting the value.

Application.SetSystemVariable("INSNAME ", "test");

 string str1 = Application.GetSystemVariable("INSNAME").ToString(​);

 

str1 string value is "" (nothing). and value is not assigning to this variable.

(We are working in AutoCAD 2010. using programming language as .net 3.5).

 

Please give advice on this issue.

4 REPLIES 4
Message 2 of 5

Try this test code:

using System;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using Autodesk.AutoCAD.EditorInput;
// This line is not mandatory, but improves loading performances
[assembly: CommandClass(typeof(Rivilis.SetVar))]
namespace Rivilis
{
    public class SetVar
    {
        [CommandMethod("SetInsName", CommandFlags.Modal)]
        public void SetInsName()
        {
            Document doc = Application.DocumentManager.MdiActiveDocument;
            Editor ed = doc.Editor;
            Application.SetSystemVariable("INSNAME", "test");
            string insname = Application.GetSystemVariable("INSNAME") as string;
            if (insname != null) {
                ed.WriteMessage("\nINSNAME = \"{0}\"", insname);
            } else  {
                ed.WriteMessage("\nCan not get INSNAME!");
            }
        }
    }
}

In what context you try to execute your's code?

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

Message 3 of 5

 

 

Thanks for your reply.

 

This is working fine in Main dll. which is attaching to autocad using netload.

But it is not working in reference dll to main dll.

 

Actually I am using above command with followed by  "Insert" Command.

 

Please advise on this

Message 4 of 5


@RamanSBV wrote:

... But it is not working in reference dll to main dll...


I did not understand what do you mean. Is that dll running in another thread?

Відповідь корисна? Клікніть на "ВПОДОБАЙКУ" цім повідомленням! | Do you find the posts helpful? "LIKE" these posts!
Находите сообщения полезными? Поставьте "НРАВИТСЯ" этим сообщениям!
На ваше запитання відповіли? Натисніть кнопку "ПРИЙНЯТИ РІШЕННЯ" | Have your question been answered successfully? Click "ACCEPT SOLUTION" button.
На ваш вопрос успешно ответили? Нажмите кнопку "УТВЕРДИТЬ РЕШЕНИЕ"


Alexander Rivilis / Александр Ривилис / Олександр Рівіліс
Programmer & Teacher & Helper / Программист - Учитель - Помощник / Програміст - вчитель - помічник
Facebook | Twitter | LinkedIn
Expert Elite Member

Message 5 of 5

 

 

While loading .net dlls into Autocad,  we will refer one dll (Main dll).

 This code is working fine in that dll.

 

Main dll will refer other dlls for UI layer and Business Layer. Right.

 

In those dll, this code is not working.

 

 

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