


{"id":391356,"date":"2024-10-25T09:35:11","date_gmt":"2024-10-25T09:35:11","guid":{"rendered":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/creating-a-polygon-with-tilted-sidewalls-via-python-api\/"},"modified":"2024-10-25T09:35:11","modified_gmt":"2024-10-25T09:35:11","slug":"creating-a-polygon-with-tilted-sidewalls-via-python-api","status":"publish","type":"topic","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/creating-a-polygon-with-tilted-sidewalls-via-python-api\/","title":{"rendered":"Creating a polygon with tilted sidewalls via python API"},"content":{"rendered":"<p>&lt;p&gt;Hello,&lt;\/p&gt;&lt;p&gt;I am trying to create a polygon with tilted sidewalls in python. I have adapted the script that is given as an example in the artical: <a href=\"https:\/\/optics.ansys.com\/hc\/en-us\/articles\/360034382334-Tips-for-adding-sidewall-angles-to-simulation-objects\">Tips for adding sidewall angles to simulation objects &ndash; Ansys Optics<\/a>&lt;\/p&gt;&lt;p&gt;My python code does look like this:&lt;\/p&gt;&lt;div&gt;&lt;div&gt;&nbsp; &nbsp; &lt;span style=&#8221;color: rgb(35, 111, 161);&#8221;&gt;name = &#8220;Angled WG&#8221;&lt;\/span&gt;&lt;\/div&gt;&lt;\/div&gt;&lt;div&gt;&lt;div&gt;&lt;span style=&#8221;color: rgb(35, 111, 161);&#8221;&gt;&nbsp; &nbsp; vertices_1 = np.array([[Epi[&#8220;Total t&#8221;], -Data[&#8220;Angled WG&#8221;][&#8220;w&#8221;]\/2], &nbsp;&lt;\/span&gt;&lt;\/div&gt;&lt;div&gt;&lt;span style=&#8221;color: rgb(35, 111, 161);&#8221;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[Epi[&#8220;Total t&#8221;] + Data[&#8220;Angled WG&#8221;][&#8220;t&#8221;], -Data[&#8220;Angled WG&#8221;][&#8220;w&#8221;]\/2],&lt;\/span&gt;&lt;\/div&gt;&lt;div&gt;&lt;span style=&#8221;color: rgb(35, 111, 161);&#8221;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[Epi[&#8220;Total t&#8221;] + Data[&#8220;Angled WG&#8221;][&#8220;t&#8221;], Data[&#8220;Angled WG&#8221;][&#8220;w&#8221;]\/2],&lt;\/span&gt;&lt;\/div&gt;&lt;div&gt;&lt;span style=&#8221;color: rgb(35, 111, 161);&#8221;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[Epi[&#8220;Total t&#8221;], Data[&#8220;Angled WG&#8221;][&#8220;w&#8221;]\/2]&lt;\/span&gt;&lt;\/div&gt;&lt;div&gt;&lt;span style=&#8221;color: rgb(35, 111, 161);&#8221;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;])&lt;\/span&gt;&lt;\/div&gt;&lt;div&gt;&lt;span style=&#8221;color: rgb(35, 111, 161);&#8221;&gt;&nbsp; &nbsp;&lt;\/span&gt;&lt;\/div&gt;&lt;div&gt;&lt;span style=&#8221;color: rgb(35, 111, 161);&#8221;&gt;&nbsp; &nbsp; mode.addpoly()&lt;\/span&gt;&lt;\/div&gt;&lt;div&gt;&lt;span style=&#8221;color: rgb(35, 111, 161);&#8221;&gt;&nbsp; &nbsp; mode.set(&#8220;vertices&#8221;, vertices_1)&lt;\/span&gt;&lt;\/div&gt;&lt;div&gt;&lt;span style=&#8221;color: rgb(35, 111, 161);&#8221;&gt;&nbsp; &nbsp; vertices = mode.get(&#8220;vertices&#8221;)&lt;\/span&gt;&lt;\/div&gt;&lt;div&gt;&lt;span style=&#8221;color: rgb(35, 111, 161);&#8221;&gt;&nbsp; &nbsp; # print(vertices)&lt;\/span&gt;&lt;\/div&gt;&lt;br&gt;&lt;div&gt;&lt;span style=&#8221;color: rgb(35, 111, 161);&#8221;&gt;&nbsp; &nbsp; mode.addlayerbuilder()&lt;\/span&gt;&lt;\/div&gt;&lt;br&gt;&lt;div&gt;&lt;span style=&#8221;color: rgb(35, 111, 161);&#8221;&gt;&nbsp; &nbsp; mode.set(&#8220;name&#8221;, &#8220;WG&#8221;)&lt;\/span&gt;&lt;\/div&gt;&lt;div&gt;&lt;span style=&#8221;color: rgb(35, 111, 161);&#8221;&gt;&nbsp; &nbsp; mode.set(&#8220;geometry&#8221;, {&#8220;1:0&#8243;: vertices})&lt;\/span&gt;&lt;\/div&gt;&lt;div&gt;&lt;span style=&#8221;color: rgb(35, 111, 161);&#8221;&gt;&nbsp; &nbsp; mode.set(&#8220;gds sidewall angle position reference&#8221;, &#8220;Bottom&#8221;)&lt;\/span&gt;&lt;\/div&gt;&lt;br&gt;&lt;div&gt;&lt;span style=&#8221;color: rgb(35, 111, 161);&#8221;&gt;&nbsp; &nbsp; n_GaN = [n_e_GaN, n_o_GaN, n_o_GaN]&lt;\/span&gt;&lt;\/div&gt;&lt;div&gt;&lt;span style=&#8221;color: rgb(35, 111, 161);&#8221;&gt;&nbsp; &nbsp; material = name&lt;\/span&gt;&lt;\/div&gt;&lt;br&gt;&lt;div&gt;&lt;span style=&#8221;color: rgb(35, 111, 161);&#8221;&gt;&nbsp; &nbsp; if mode.getmaterial(name) == str(&#8220;The material, &#8221; + name + &#8220;, is not available.&#8221;):&lt;\/span&gt;&lt;\/div&gt;&lt;div&gt;&lt;span style=&#8221;color: rgb(35, 111, 161);&#8221;&gt;&nbsp; &nbsp; &nbsp; &nbsp; mode.setmaterial(mode.addmaterial(&#8220;(n,k) Material&#8221;), &#8220;name&#8221;, material)&lt;\/span&gt;&lt;\/div&gt;&lt;br&gt;&lt;div&gt;&lt;span style=&#8221;color: rgb(35, 111, 161);&#8221;&gt;&nbsp; &nbsp; &nbsp; &nbsp; mode.setmaterial(material, &#8220;Anisotropy&#8221;, 1) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Diagonal Anisotropy&lt;\/span&gt;&lt;\/div&gt;&lt;div&gt;&lt;span style=&#8221;color: rgb(35, 111, 161);&#8221;&gt;&nbsp; &nbsp; &nbsp; &nbsp; mode.setmaterial(&lt;\/span&gt;&lt;\/div&gt;&lt;div&gt;&lt;span style=&#8221;color: rgb(35, 111, 161);&#8221;&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; material, {&#8220;Refractive Index&#8221;: np.array(n_GaN), &#8220;Imaginary Refractive Index&#8221;: 0}&lt;\/span&gt;&lt;\/div&gt;&lt;div&gt;&lt;span style=&#8221;color: rgb(35, 111, 161);&#8221;&gt;&nbsp; &nbsp; &nbsp; &nbsp; ) &nbsp; &nbsp; &nbsp; &nbsp;&lt;\/span&gt;&lt;\/div&gt;&lt;br&gt;&lt;div&gt;&lt;span style=&#8221;color: rgb(35, 111, 161);&#8221;&gt;&nbsp; &nbsp; mode.addlayer(&#8220;WG Layer&#8221;)&lt;\/span&gt;&lt;\/div&gt;&lt;div&gt;&lt;span style=&#8221;color: rgb(35, 111, 161);&#8221;&gt;&nbsp; &nbsp; mode.setlayer(&#8220;WG Layer&#8221;, &#8220;layer number&#8221;, &#8220;1:0&#8243;)&lt;\/span&gt;&lt;\/div&gt;&lt;div&gt;&lt;span style=&#8221;color: rgb(35, 111, 161);&#8221;&gt;&nbsp; &nbsp; mode.setlayer(&#8220;WG Layer&#8221;, &#8220;thickness&#8221;, Data[&#8220;Angled WG&#8221;][&#8220;t&#8221;])&lt;\/span&gt;&lt;\/div&gt;&lt;div&gt;&lt;span style=&#8221;color: rgb(35, 111, 161);&#8221;&gt;&nbsp; &nbsp; mode.setlayer(&#8220;WG Layer&#8221;, &#8220;pattern material&#8221;, material)&lt;\/span&gt;&lt;\/div&gt;&lt;div&gt;&lt;span style=&#8221;color: rgb(35, 111, 161);&#8221;&gt;&nbsp; &nbsp; mode.setlayer(&#8220;WG Layer&#8221;, &#8220;sidewall angle&#8221;, Data[&#8220;Angled WG&#8221;][&#8220;angle&#8221;])&lt;\/span&gt;&lt;\/div&gt;&lt;\/div&gt;&lt;p&gt;The code runs, however, the polygon with the sidewalls is not created via the layer builder&lt;\/p&gt;&lt;p&gt;<img decoding=\"async\" src=\"https:\/\/innovationspace.ansys.com\/forum\/wp-content\/uploads\/sites\/2\/2024\/10\/25-10-2024-1729848723-mceclip1.png\" \/>&lt;\/p&gt;&lt;p&gt;&nbsp;&lt;\/p&gt;&lt;p&gt;Could you help me with fixing this issue?&lt;\/p&gt;&lt;p&gt;Kind regards,&lt;\/p&gt;&lt;p&gt;Matthias Hoormann&lt;\/p&gt;<\/p>\n","protected":false},"template":"","class_list":["post-391356","topic","type-topic","status-publish","hentry","topic-tag-polygon-objects","topic-tag-python-scripting"],"aioseo_notices":[],"acf":[],"custom_fields":[{"0":{"_bbp_subscription":["143292","473055"],"_bbp_author_ip":["134.169.113.230"],"_btv_view_count":["260"],"_bbp_topic_status":["unanswered"],"_bbp_notification_enabled":["473055"],"_bbp_topic_id":["391356"],"_bbp_forum_id":["27833"],"_bbp_engagement":["143292","473055"],"_bbp_voice_count":["2"],"_bbp_reply_count":["1"],"_bbp_last_reply_id":["391666"],"_bbp_last_active_id":["391666"],"_bbp_last_active_time":["2024-10-29 01:04:13"]},"test":"m-hoormanntu-braunschweig-de"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/391356","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics"}],"about":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/391356\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=391356"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}