New Member
Posts: 1
Registered: ‎03-13-2006
Message 1 of 2 (177 Views)

Late binding and enums

177 Views, 1 Replies
03-13-2006 02:40 PM

I have a program in VB.Net with option strict off.
I don't want to make a reference to any Autodesk dll in my project. I do this to remain independent on the version of AutoCAD.

I create an AutoCad Instance like this.
Dim m_AcadApp as Object = CreateObject("Autocad.Application")

everything is fine until I need a constant. The constants are in ObjectDBX.

I know if I were linked to the dll in my project I could use the constants like this:

Can I use the enums without knowing their value. Or do I need to rewrite each of them with their value in my code.
Distinguished Contributor
Posts: 125
Registered: ‎08-02-2005
Message 2 of 2 (177 Views)

Re: Late binding and enums

03-14-2006 08:38 AM in reply to: okidoo

You probably should look up the definition of Enum if you want a deeper explanation on this.

An Enumeration is a set of VALUES logically related to each other. Since you are late-binding, the compiler doesn't know what value to assign to acAlignmentBottomCenter (13 in this case). The acAlignmentBottomCenter variable is really a shared constant with the value of 13. The AcAlignment Enum is just a nice way of saying...I have this group of unique values which I want to assign names so that others will know what the values are for.

So, not only do you need to declare the constant acAlignmentBottomCenter, but you also need to assign its value of 13, because this is ultimately what AutoCAD 'sees' and it knows that 13 = acAlignmentBottomCenter.

This means that if you know the value of the Enum Member you want, you don't really to define it at all, you could just use 13. But acAlignmentBottomCenter doesn't equal anything if it is not defined.

Also note that Enums can be any of the following: Byte, Integer, Long, SByte, Short, UInteger, ULong, or UShort.

Here is the Enum you need.....

Enum AcAlignment As Integer
acAlignmentLeft = 0
acAlignmentCenter = 1
acAlignmentRight = 2
acAlignmentAligned = 3
acAlignmentMiddle = 4
acAlignmentFit = 5
acAlignmentTopLeft = 6
acAlignmentTopCenter = 7
acAlignmentTopRight = 8
acAlignmentMiddleLeft = 9
acAlignmentMiddleCenter = 10
acAlignmentMiddleRight = 11
acAlignmentBottomLeft = 12
acAlignmentBottomCenter = 13
acAlignmentBottomRight = 14
End Enum
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.