Property Manager Page

Hi.

How I can operate design of a tab visually in Visual Studio 2008, instead of by means of a code? In addon there is only a class with dynamically created components.

SolidworksApi macros
Answers 14
RJ
RJ 2011-01-27 Best Answer

Oleg,

I am afraid but there is not direct way. You can only do it via code.

A direct method would have been really helpful though..

Hope it helps!!!

Rajat Jain

SF
SF 2011-01-27

Thanks, but I find another way)))

It is possible to make the UserControl and to push it in PropertyManagerPage.
SF
SF 2011-02-01

Nothing can be inserted into a PMP other than their own controls - at least no documented way, may be possible with a bit of hacking and C++ but never bothered trying.

Instead just move to a Taskpane, you get visual designing, controls, full control etc...

http://www.angelsix.com/cms/features/tutorials/64-solidworks/67-creating-a-solidworks-add-in-from-scratch

Luke Malpass

AngelSix (SolidWorks Tutorials and Books)

BatchProcess

SF
SF 2011-02-22

Yes you can throw a UserControl into a PMP.

http://solidworks.codeplex.com/

SF
SF 2011-02-22

chris misztur

It's a GREAT news!

Big thank's.

SF
SF 2011-02-22

you're welcome!

if you have questions about http://solidworks.codeplex.com, post them in the discussions @ http://solidworks.codeplex.com.

to install, run binAnyCpu\reg32.NET4.bat or reg64.NET4.bat from command prompt.  Run as ADMINISTRATOR!

SF
SF 2011-02-22

It is a pity that for 2010 studio. I work on 2008.
And questions will be...

SF
SF 2011-02-23

Cool! We now have a sample of managed code to insert AX controls into PMPs.

Luke Malpass

AngelSix (SolidWorks Tutorials and Books)

BatchProcess

SF
SF 2011-02-23

It should work in 2008 with the correct version libs.  

SF
SF 2011-02-23

It's pretty simple...

Your control <- ActiveXUserControlBase <- UserControlBase <- UserControl.

[Export(typeof(IExternalUserControl))] attribute lets the main host class know that this is going to be a user control.

[HostedAsPropertyPage] attribute lets the main host class know to host this control as a property page in SW.

Inside your control you can attribute methods with [SinkMethod] attribute.  When you do this, the method will be invoked when the appropriate SW event is fired ( such as DocumentDestroy or NewSelectionNotify, etc).

boom, you're done.

Template:

<p>using SwAddinHelpers.Base;<br>using SwAddinHelpers.Contracts;<br>using SwAddinHelpers.Attributes;<br>using System.Runtime.InteropServices;<br>using System.ComponentModel;<br>using System.ComponentModel.Composition;<br>using System.ComponentModel.Design;<br>using System.ComponentModel.Composition.Hosting;<br>using System.Reflection;<br><br>namespace ExternalControls<br>{<br>    [ComVisible(true)]<br>    [ProgId(PROGID)]<br>    [Export(typeof(IExternalUserControl))]<br>    [HostedAsPropertyPage]<br>    public class ExternalPropertyPageControlTemplate1: ActiveXUserControlBase, IExternalUserControl<br>    {<br>        public const string PROGID = "SwExternalControls.ExternalPropertyPageControlTemplate1";<br><br>        public ExternalPropertyPageControlTemplate1()<br>        {<br>            InitializeComponent();<br>        }<br><br>        public dynamic ExternalUserControl<br>        {<br>            get { return this; }<br>        }<br><br>        [SinkMethod(SwAddinHelpers.Sinks.enumEventSink.SW_ActiveModelDocChangeNotify,true)]<br>        public void SomeMethodToFire(object sender, EventArgs e)<br>        {<br><br>        }<br><br>        [InvokableMethod("TestMethod1")]<br>        public void TestMethod()<br>        {<br>            <br>        }<br><br>    }<br>}<br><br><br><br></p>
SF
SF 2011-02-28

Hi Chris,

Your addon allways run with this:

ngen сouldn't help

SF
SF 2011-02-28

You have .NET 4 installed?

Which batch file did you use to register the assemblies?

Can you post the output of the batch file?

Can you show the registry keys for your addins?

SF
SF 2011-02-28

Oops all work. After use the batch file's. All appears except flyoutpanel. On right-mouse-button it is not activated

SF
SF 2011-02-28

Excellent!

Was flyoutpanel supported in 2010?

Looking through the 2011 API docs it looks like they've added new methods to use .NET controls...