Tuesday, February 07, 2012
AssemblyProperties Interface
Last Post 21 Jul 2010 10:32 PM by fatkids. 2 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
fatkidsUser is Offline
New Member
New Member
Posts:53

--
20 Jul 2010 09:23 PM  

Hi all,

In the SE SDK has the "AssemblyProperties" interface.

I want to get something through this interface, but the results is null.

I want to add something to model through AddProperty(String) and AddPropertyItem(String, PropertyTypeConstants, Object)  method, but I can not find the content I added in models.

In models, Where is AssemblyProperties????

my program:

SolidEdgeFramework.Application SEApp = null;
            SolidEdgeFramework.SolidEdgeDocument SEDoc = null;
            SolidEdgeAssembly.AssemblyDocument ASMDoc = null;

            SolidEdgeAssembly.AssemblyProperties asm_props = null;
            SolidEdgeAssembly.AssemblyProperty asm_prop = null;

            SEApp = Marshal.GetActiveObject("SolidEdge.Application") as SolidEdgeFramework.Application;

            SEDoc = SEApp.ActiveDocument as SolidEdgeFramework.SolidEdgeDocument;
            if (SEDoc.Type == SolidEdgeFramework.DocumentTypeConstants.igAssemblyDocument)
            {
                ASMDoc = SEDoc as SolidEdgeAssembly.AssemblyDocument;
                asm_props = ASMDoc.AssemblyProperties;

******************get ************************************but is null
                for (int i = 1; i <= asm_props.Count; i++)
                {
                    asm_prop = asm_props.Item(i);
                    MessageBox.Show(asm_prop.Name);
                }

**********************************************************
*****************add************************************but I can not find in model

                asm_props.AddProperty("hello asm");
                asm_prop = asm_props.Item(1);
                asm_prop.AddPropertyItem("111", SolidEdgePart.PropertyTypeConstants.sePropertyTypeString,(object)("hell"));

            }

Please help!

Thanks!

Jason NewellUser is Offline
Site Owner
Advanced Member
Advanced Member
Posts:895
Avatar

--
21 Jul 2010 07:22 PM  

This worked for me on ST2.

using System;
using System.Reflection;
using System.Runtime.InteropServices;

namespace SETest
{
    class Program
    {
        static void Main(string[] args)
        {
            SolidEdgeFramework.Application application = (SolidEdgeFramework.Application)Marshal.GetActiveObject("SolidEdge.Application");
            SolidEdgeAssembly.AssemblyDocument assemblyDocument = (SolidEdgeAssembly.AssemblyDocument)application.ActiveDocument;
            SolidEdgeAssembly.AssemblyProperties assemblyProperties = assemblyDocument.AssemblyProperties;
            SolidEdgeAssembly.AssemblyProperty assemblyProperty = assemblyProperties.AddProperty("My Property");
            assemblyProperty.AddPropertyItem("My Item", SolidEdgePart.PropertyTypeConstants.sePropertyTypeString, "My Item Value");
            object value = assemblyProperty.GetItemValue("My Item");
        }
    }
}
Jason Newell
Applications Architect
www.jasonnewell.net
fatkidsUser is Offline
New Member
New Member
Posts:53

--
21 Jul 2010 10:32 PM  
Thanks jason!
Can I find this assemblyProperty in the SE's interface ?
You are not authorized to post a reply.

Active Forums 4.2
Copyright © 2011 JasonNewell.NET