Announcements

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

AutoCAD's Properties Palette modification

s_abeed
Enthusiast

AutoCAD's Properties Palette modification

s_abeed
Enthusiast
Enthusiast

I am trying to modify the AutoCAD's Properties Palette for custom properties and have success using .NET mechanism as get exposed in the links below without implementing any COM interface. However property categorization support is not there. Anyone knows how to add that support ?

 

- [Exposing AutoCAD's Properties Palette functionality to .NET - Part 1](http://through-the-interface.typepad.com/through_the_interface/2009/03/exposing-autocads-properties-...)
- [Exposing AutoCAD's Properties Palette functionality to .NET - Part 2](http://through-the-interface.typepad.com/through_the_interface/2009/03/exposing-autocads-properties-...)

0 Likes
Reply
Accepted solutions (1)
757 Views
5 Replies
Replies (5)

ActivistInvestor
Advisor
Advisor

Have you looked at the ICategorizeProperties interface?

0 Likes

Anton_Huizinga
Advocate
Advocate

If I remember well this is not exposed in .NET.

0 Likes

ActivistInvestor
Advisor
Advisor

This is a standard COM interface defined by Windows, so it doesn't have to be 'exposed' to .net. by AutoCAD.

 

 

[ComImport]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[Guid("4D07FC10-F931-11CE-B001-00AA006884E5")]
public interface ICategorizeProperties
{
	[MethodImpl(MethodImplOptions.PreserveSig | MethodImplOptions.InternalCall)]
	int MapPropertyToCategory([In] int dispid, out int ppropcat);

	[MethodImpl(MethodImplOptions.PreserveSig | MethodImplOptions.InternalCall)]
	int GetCategoryName([In] int PROPCAT, [In] uint lcidCategory, [MarshalAs(UnmanagedType.BStr)] out string pbstrName);
}

 

 

 

You need to implement QueryInterface() and when the framework calls that with the IID for ICategorizeProperties, you return a pointer to the IUnknown that implements the interface.

 

  1.  

s_abeed
Enthusiast
Enthusiast

Implementing what you mentioned I am getting call backs but not sure how to add new categorize and map the properties to categorize

 

This is what I have done. Before your reply I was implementing IDynamicProperty2 and it shows the custom properties.

public class CustomProp : IDynamicProperty2

 

With your suggestions I define the interface definition of ICategorizeProperties by cut copy paste from your smaple above and then try to implement this interface as well like below.

 

public class CustomProp : IDynamicProperty2, ICategorizeProperties

 

Now I am getting some call backs but not sure what to do next. 

 

Is there any sample code available ?

 

thanks

Salman

 

0 Likes

s_abeed
Enthusiast
Enthusiast
Accepted solution

By implementing IAcPiCategorizeProperties this issue is now resolved. 

0 Likes