How to get surfacebody.Name in Apprentice?

How to get surfacebody.Name in Apprentice?

zy19860604
Collaborator Collaborator
403 Views
6 Replies
Message 1 of 7

How to get surfacebody.Name in Apprentice?

zy19860604
Collaborator
Collaborator

I run the following code.

I get a error that I can't get surfacebody.Name.

Have you another way to get surfacebody.Name in Apprentice?

zy19860604_0-1688083567332.png

 

 

 

0 Likes
404 Views
6 Replies
Replies (6)
Message 2 of 7

A.Acheson
Mentor
Mentor

Hi @zy19860604 

Can you post the code?  With apprentice you don't have access to the inventor model so this might be the issue your facing. You can only do certain operations like read and write iproperties. 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 3 of 7

zy19860604
Collaborator
Collaborator

static void Main(string[] args) { Inventor.ApprenticeServerComponent invApprentice=new Inventor.ApprenticeServerComponent(); Inventor.ApprenticeServerDocument invDoc = invApprentice.Open(@"D:\FSMT_Vault\Project\S23G04\ZONE D\3d\STANDV-A-0615-P1081.ipt"); foreach(Inventor.SurfaceBody surfaceBody in invDoc.ComponentDefinition.SurfaceBodies) { Console.WriteLine(surfaceBody.Name); } //GetFaceAndEdgeInfo(invDoc); Console.ReadLine(); }

0 Likes
Message 4 of 7

florian_wenzel
Advocate
Advocate

Hi,

in Autodeks Inventor you need to start from [1] not from [0]

In Array or List, then from [0].

But all Edges, Vertex, Bodies, etc from [1]

 

Message 5 of 7

zy19860604
Collaborator
Collaborator

In VB.Net start from(1). In C# start from [0]. I use C#. I think it is no problem.

Message 6 of 7

florian_wenzel
Advocate
Advocate

it dosent matter or C# or VB.NET. i use also C#.

In my Opinion,  you are not able to get for example:

 

 

SurfaceBody oBody = oCompDef.SurfaceBodies[0];

 

start from 1

 

SurfaceBody oBody = oCompDef.SurfaceBodies[1];

 

But when you know Better, as you wish

Message 7 of 7

zy19860604
Collaborator
Collaborator

I think the following code is no problem.

static void Main(string[] args)
        {
            Inventor.ApprenticeServerComponent invApprentice=new Inventor.ApprenticeServerComponent();
            Inventor.ApprenticeServerDocument invDoc = invApprentice.Open(@"D:\FSMT_Vault\Project\S23G04\ZONE D\3d\STANDV-A-0615-P1081.ipt"); 
            foreach(Inventor.SurfaceBody surfaceBody in invDoc.ComponentDefinition.SurfaceBodies)
            {
                Console.WriteLine(surfaceBody.Name);
            }            
            Console.ReadLine();
        }
0 Likes