Valued Mentor
Posts: 354
Registered: ‎01-27-2010
Message 1 of 2 (139 Views)

How to check and manage Unit for insert a BlockReference

139 Views, 1 Replies
02-26-2012 10:38 AM

Hi all i have a VBA code for check and choose unit but how i can in .NET ?

    Unite = ThisDrawing.GetVariable("INSUNITS")
    Select Case Unite
      Case 4: Unite = 10 'mm
      Case 5: Unite = 1   'cm
      Case 6: Unite = 0.01   'm
      Case Else: Unite = 1
    End Select

 i dont find help for this..

db.UnitMode is always = 0

i have try this :

Dim BlocT As BlockTable
        Dim tr As Transaction = db.TransactionManager.StartTransaction
        BlocT = tr.GetObject(db.BlockTableId, OpenMode.ForRead)
        Dim Bloc As BlockTableRecord
        Bloc = tr.GetObject(BlocT(BlockTableRecord.ModelSpace), OpenMode.ForRead)
        Dim lay As Layout = tr.GetObject(Bloc.LayoutId, OpenMode.ForRead)

 but bloc.units dont egal the unit command in autocad.

I can use  :

Dim obj As Object = Application.GetSystemVariable("INSUNITS")

but i want a proper solution with .net.


anyone can help ?

Posts: 1,346
Registered: ‎04-09-2008
Message 2 of 2 (133 Views)

Re: How to check and manage Unit for insert a BlockReference

02-26-2012 11:45 AM in reply to: AubelecBE

Database.Insunits ?

Пожалуйста не забывайте про Утвердить в качестве решения! Утвердить в качестве решения и Give Kudos!Баллы
Please remember to Accept Solution! Accept as Solution and Give Kudos!Kudos

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Welcome to the new Autodesk Community!
If this is your first visit, click here to get started and make the most of the Community. Let us know what you think of the new experience in the Community Feedback Forum.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community