.NET

Reply
*C Witt
Message 1 of 15 (514 Views)

Multiple acdbmgd & acmgd references?

514 Views, 14 Replies
01-19-2009 01:54 PM

Is it possible to reference more than one version of these files in a
single project?



The reason I ask is that the 2 version of AutoCAD we are using have
different "properties" for the objects in question (the names change)...



--

Work: VISTA Ultimate x32 - AMD 64 X2
Dual Core 4200 2.2GHz, 4 Gigs Ram, GeForce
6800GS 256MB


Home: VISTA Ultimate x64 - AMD 64 Quad
Core 2.2GHz, 8 Gigs Ram, GeForce 8600GT 512MB


Laptop (17" HP): VISTA Premium x32 -
color="#000000">AMD Turion X2 Dual Core TL-50 1.6GHz, 2 Gigs Ram,
color="#666666">Nvidia GeForce 6150

*Tony Tanzillo
Message 2 of 15 (514 Views)

Re: Multiple acdbmgd & acmgd references?

01-19-2009 02:34 PM in reply to: *C Witt
No, you can't do that.

What properties are changed?

"C Witt" wrote in message
news:6107669@discussion.autodesk.com...
Is it possible to reference more than one version of these files in a single
project?

The reason I ask is that the 2 version of AutoCAD we are using have
different "properties" for the objects in question (the names change)...


--
Work: VISTA Ultimate x32 - AMD 64 X2 Dual Core 4200 2.2GHz, 4 Gigs Ram,
GeForce 6800GS 256MB
Home: VISTA Ultimate x64 - AMD 64 Quad Core 2.2GHz, 8 Gigs Ram, GeForce
8600GT 512MB
Laptop (17" HP): VISTA Premium x32 - AMD Turion X2 Dual Core TL-50 1.6GHz, 2
Gigs Ram, Nvidia GeForce 6150
*C Witt
Message 3 of 15 (514 Views)

Re: Multiple acdbmgd & acmgd references?

01-19-2009 03:22 PM in reply to: *C Witt

The textstyle property of the text object changed from "textstyle" to
"textstyleid"...



Work: VISTA
Ultimate x32 - AMD 64 X2 Dual Core 4200 2.2GHz, 4 Gigs Ram,
color="#666666">GeForce 6800GS 256MB


Home: VISTA Ultimate x64 - AMD 64 Quad
Core 2.2GHz, 8 Gigs Ram, GeForce 8600GT 512MB


Laptop (17" HP): VISTA Premium x32 -
color="#000000">AMD Turion X2 Dual Core TL-50 1.6GHz, 2 Gigs Ram,
color="#666666">Nvidia GeForce 6150





Tony Tanzillo wrote:

No, you can't do that.

What properties are changed?

"C Witt" <cwitt_AT_trkeng.com> wrote in message
news:6107669@discussion.autodesk.com...
Is it possible to reference more than one version of these files in a single
project?

The reason I ask is that the 2 version of AutoCAD we are using have
different "properties" for the objects in question (the names change)...




*Tony Tanzillo
Message 4 of 15 (514 Views)

Re: Multiple acdbmgd & acmgd references?

01-19-2009 09:03 PM in reply to: *C Witt
Are you using Visual Studio 2008 ?

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009
http://www.acadxtabs.com

Introducing AcadXTabs 2010:
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm


"C Witt" wrote in message
news:6107734@discussion.autodesk.com...
The textstyle property of the text object changed from "textstyle" to
"textstyleid"...


Work: VISTA Ultimate x32 - AMD 64 X2 Dual Core 4200 2.2GHz, 4 Gigs Ram,
GeForce 6800GS 256MB
Home: VISTA Ultimate x64 - AMD 64 Quad Core 2.2GHz, 8 Gigs Ram, GeForce
8600GT 512MB
Laptop (17" HP): VISTA Premium x32 - AMD Turion X2 Dual Core TL-50 1.6GHz, 2
Gigs Ram, Nvidia GeForce 6150


Tony Tanzillo wrote:
No, you can't do that.

What properties are changed?

"C Witt" wrote in message
news:6107669@discussion.autodesk.com...
Is it possible to reference more than one version of these files in a single
project?

The reason I ask is that the 2 version of AutoCAD we are using have
different "properties" for the objects in question (the names change)...
*C Witt
Message 5 of 15 (514 Views)

Re: Multiple acdbmgd & acmgd references?

01-20-2009 08:42 AM in reply to: *C Witt

yes



Work: VISTA
Ultimate/Windows 7 x32 - AMD 64 X2 Dual Core 4200 2.2GHz, 4 Gigs
Ram, GeForce 6800GS 256MB


Home: VISTA Ultimate x64 - AMD 64 Quad
Core 2.2GHz, 8 Gigs Ram, GeForce 8600GT 512MB


Laptop (17" HP): VISTA Premium x32 -
color="#000000">AMD Turion X2 Dual Core TL-50 1.6GHz, 2 Gigs Ram,
color="#666666">Nvidia GeForce 6150





Tony Tanzillo wrote:

Are you using Visual Studio 2008 ?



*Tony Tanzillo
Message 6 of 15 (514 Views)

Re: Multiple acdbmgd & acmgd references?

01-20-2009 09:11 AM in reply to: *C Witt
The only option would be to use reflection.

The class below defines two extension methods for
DBText and MText that can be used in either release:

You use them just like they were methods of the
DBText and MText objects:

ObjectId GetTextStyleId();

void SetTextStyleId( ObjectId value );

[code]

{code}

public static class VersionCompatibleExtensionMethods
{
public static ObjectId GetTextStyleId( this DBText instance )
{
if( textStyleProperty != null )
return (ObjectId) textStyleProperty.GetValue( instance, null );
else
throw new MissingMemberException();
}

public static ObjectId GetTextStyleId( this MText instance )
{
if( mtextStyleProperty != null )
return (ObjectId) mtextStyleProperty.GetValue( instance, null );
else
throw new MissingMemberException();
}

public static void SetTextStyleId( this DBText instance, ObjectId value )
{
if( textStyleProperty != null )
textStyleProperty.SetValue( instance, value, null );
else
throw new MissingMemberException();
}

public static void SetTextStyleId( this MText instance, ObjectId value )
{
if( mtextStyleProperty != null )
mtextStyleProperty.SetValue( instance, value, null );
else
throw new MissingMemberException();
}

static VersionCompatibleExtensionMethods()
{
textStyleProperty = typeof( DBText ).GetProperty( "TextStyle" );
if( textStyleProperty == null )
textStyleProperty = typeof( DBText ).GetProperty( "TextStyleId" );
mtextStyleProperty = typeof( DBText ).GetProperty( "TextStyle" );
if( mtextStyleProperty == null )
mtextStyleProperty = typeof( DBText ).GetProperty( "TextStyleId" );
}

private static PropertyInfo textStyleProperty = null;
private static PropertyInfo mtextStyleProperty = null;
}


{code}

[/code]

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009
http://www.acadxtabs.com

Introducing AcadXTabs 2010:
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm


"C Witt" wrote in message
news:6108204@discussion.autodesk.com...
yes


Work: VISTA Ultimate/Windows 7 x32 - AMD 64 X2 Dual Core 4200 2.2GHz, 4 Gigs
Ram, GeForce 6800GS 256MB
Home: VISTA Ultimate x64 - AMD 64 Quad Core 2.2GHz, 8 Gigs Ram, GeForce
8600GT 512MB
Laptop (17" HP): VISTA Premium x32 - AMD Turion X2 Dual Core TL-50 1.6GHz, 2
Gigs Ram, Nvidia GeForce 6150


Tony Tanzillo wrote:
Are you using Visual Studio 2008 ?
*C Witt
Message 7 of 15 (514 Views)

Re: Multiple acdbmgd & acmgd references?

01-20-2009 10:15 AM in reply to: *C Witt

Thank you Tony, I will give that a shot!



Work: VISTA
Ultimate/Windows 7 x32 - AMD 64 X2 Dual Core 4200 2.2GHz, 4 Gigs
Ram, GeForce 6800GS 256MB


Home: VISTA Ultimate x64 - AMD 64 Quad
Core 2.2GHz, 8 Gigs Ram, GeForce 8600GT 512MB


Laptop (17" HP): VISTA Premium x32 -
color="#000000">AMD Turion X2 Dual Core TL-50 1.6GHz, 2 Gigs Ram,
color="#666666">Nvidia GeForce 6150





Tony Tanzillo wrote:

The only option would be to use reflection.

The class below defines two extension methods for
DBText and MText that can be used in either release:

You use them just like they were methods of the
DBText and MText objects:

ObjectId GetTextStyleId();

void SetTextStyleId( ObjectId value );

[code]
<code>
{code}

public static class VersionCompatibleExtensionMethods
{
public static ObjectId GetTextStyleId( this DBText instance )
{
if( textStyleProperty != null )
return (ObjectId) textStyleProperty.GetValue( instance, null );
else
throw new MissingMemberException();
}

public static ObjectId GetTextStyleId( this MText instance )
{
if( mtextStyleProperty != null )
return (ObjectId) mtextStyleProperty.GetValue( instance, null );
else
throw new MissingMemberException();
}

public static void SetTextStyleId( this DBText instance, ObjectId value )
{
if( textStyleProperty != null )
textStyleProperty.SetValue( instance, value, null );
else
throw new MissingMemberException();
}

public static void SetTextStyleId( this MText instance, ObjectId value )
{
if( mtextStyleProperty != null )
mtextStyleProperty.SetValue( instance, value, null );
else
throw new MissingMemberException();
}

static VersionCompatibleExtensionMethods()
{
textStyleProperty = typeof( DBText ).GetProperty( "TextStyle" );
if( textStyleProperty == null )
textStyleProperty = typeof( DBText ).GetProperty( "TextStyleId" );
mtextStyleProperty = typeof( DBText ).GetProperty( "TextStyle" );
if( mtextStyleProperty == null )
mtextStyleProperty = typeof( DBText ).GetProperty( "TextStyleId" );
}

private static PropertyInfo textStyleProperty = null;
private static PropertyInfo mtextStyleProperty = null;
}


{code}
</code>
[/code]



*Terry W. Dotson
Message 8 of 15 (514 Views)

Re: Multiple acdbmgd & acmgd references?

03-26-2009 12:50 PM in reply to: *C Witt
C Witt wrote:

> The textstyle property of the text object changed from "textstyle" to
> "textstyleid"...

If you are using VB on VS2005 and need to support 2007 then this appears
to work.

If AcdApp.Version = 17.0 Then
CallByName(AddEnt, "TextStyle", CallType.Set, StyRec.ObjectId)
Else
CallByName(AddEnt, "TextStyleId", CallType.Set, StyRec.ObjectId)
End If

Terry
*Tony Tanzillo
Message 9 of 15 (515 Views)

Re: Multiple acdbmgd & acmgd references?

03-26-2009 07:07 PM in reply to: *C Witt
Rather than branching once when the code loads, your so-called
solution branches every single time the property's value is needed.

Astounding.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009

http://www.acadxtabs.com

Introducing AcadXTabs 2010:
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm


"Terry W. Dotson" wrote in message
news:6150151@discussion.autodesk.com...
C Witt wrote:

> The textstyle property of the text object changed from "textstyle" to
> "textstyleid"...

If you are using VB on VS2005 and need to support 2007 then this appears
to work.

If AcdApp.Version = 17.0 Then
CallByName(AddEnt, "TextStyle", CallType.Set, StyRec.ObjectId)
Else
CallByName(AddEnt, "TextStyleId", CallType.Set, StyRec.ObjectId)
End If

Terry
*Tony Tanzillo
Message 10 of 15 (514 Views)

Re: Multiple acdbmgd & acmgd references?

03-26-2009 07:12 PM in reply to: *C Witt
For those that use VS2005, you can still use the code posted
as extension methods, by just converting them to plain old
static methods (non-extension methods), and passing the
DBText or MText objects to them as the first parameter. Just
remove the 'this' from first parameter declaration.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009

http://www.acadxtabs.com

Introducing AcadXTabs 2010:
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm


"Tony Tanzillo" wrote in message
news:6108262@discussion.autodesk.com...
The only option would be to use reflection.

The class below defines two extension methods for
DBText and MText that can be used in either release:

You use them just like they were methods of the
DBText and MText objects:

ObjectId GetTextStyleId();

void SetTextStyleId( ObjectId value );

[code]

{code}

public static class VersionCompatibleExtensionMethods
{
public static ObjectId GetTextStyleId( this DBText instance )
{
if( textStyleProperty != null )
return (ObjectId) textStyleProperty.GetValue( instance, null );
else
throw new MissingMemberException();
}

public static ObjectId GetTextStyleId( this MText instance )
{
if( mtextStyleProperty != null )
return (ObjectId) mtextStyleProperty.GetValue( instance, null );
else
throw new MissingMemberException();
}

public static void SetTextStyleId( this DBText instance, ObjectId value )
{
if( textStyleProperty != null )
textStyleProperty.SetValue( instance, value, null );
else
throw new MissingMemberException();
}

public static void SetTextStyleId( this MText instance, ObjectId value )
{
if( mtextStyleProperty != null )
mtextStyleProperty.SetValue( instance, value, null );
else
throw new MissingMemberException();
}

static VersionCompatibleExtensionMethods()
{
textStyleProperty = typeof( DBText ).GetProperty( "TextStyle" );
if( textStyleProperty == null )
textStyleProperty = typeof( DBText ).GetProperty( "TextStyleId" );
mtextStyleProperty = typeof( DBText ).GetProperty( "TextStyle" );
if( mtextStyleProperty == null )
mtextStyleProperty = typeof( DBText ).GetProperty( "TextStyleId" );
}

private static PropertyInfo textStyleProperty = null;
private static PropertyInfo mtextStyleProperty = null;
}


{code}

[/code]

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009
http://www.acadxtabs.com

Introducing AcadXTabs 2010:
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm


"C Witt" wrote in message
news:6108204@discussion.autodesk.com...
yes


Work: VISTA Ultimate/Windows 7 x32 - AMD 64 X2 Dual Core 4200 2.2GHz, 4 Gigs
Ram, GeForce 6800GS 256MB
Home: VISTA Ultimate x64 - AMD 64 Quad Core 2.2GHz, 8 Gigs Ram, GeForce
8600GT 512MB
Laptop (17" HP): VISTA Premium x32 - AMD Turion X2 Dual Core TL-50 1.6GHz, 2
Gigs Ram, Nvidia GeForce 6150


Tony Tanzillo wrote:
Are you using Visual Studio 2008 ?
Need installation help?

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