Create SectionView by C# Script Grasshopper

I’m trying to write a C# Script Create Section View through the Tekla API version 2020. I’m trying to output View and SectionMark , but I’m having a code problem. Anyone can help me? Thank you
C# Script.gh (4.9 KB)

Hi, the Tekla API method View.CreateSectionView medthod seems to let you do this. First I guess you should cast your RunScript arguments to whatever types are required by the Tekla method (this includes creating Tekla Points from the Rhino Point3d points by using their coordinates).

View.CreateSectionView also requires the view you want to place your section mark into as an argument, so you’d need to obtain that somehow.

If you go to the Tekla API forums there might be better examples in some of the questions or you could quickly get answers to API-related questions. For basic view creation there’s also a code example on developer.tekla.com: Code example: Create views in drawings | Tekla Developer Center

Cheers,

-b

2 Likes

@sebastian.lindholm beat me by 5 minutes :sweat_smile:

You copied the method definition, instead of actually using it.

https://developer.tekla.com/tekla-structures/api/22/12444

Untested code below but should give you a head start. I’m not sure how you can get the active view though.

C# Script.gh (5.8 KB)

2 Likes

THANK YOU, IT WORKED, AMAZING :star_struck: :star_struck: :star_struck:

1 Like