


{"id":166360,"date":"2022-02-14T04:47:04","date_gmt":"2022-02-14T04:47:04","guid":{"rendered":"\/forum\/forums\/topic\/adding-new-structure-to-lumerical-via-python-using-addplanarsolid\/"},"modified":"2022-02-22T21:56:28","modified_gmt":"2022-02-22T21:56:28","slug":"adding-new-structure-to-lumerical-via-python-using-addplanarsolid","status":"closed","type":"topic","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/adding-new-structure-to-lumerical-via-python-using-addplanarsolid\/","title":{"rendered":"Adding new structure to lumerical via Python using &#8216;addplanarsolid&#8217;"},"content":{"rendered":"<div class=\"Item-Body\">\n<div class=\"Message userContent\">\n<p>I&#039;m trying to add a new structure to Lumerical using the command &#039;addplanarsolid&#039;.<\/p>\n<p>In detail, following the &#039;Drawing truncated cone in finite element.lsf&#039;, I have&nbsp;understood the script and converted to Python in order to conduct it by Python.<\/p>\n<p><a href=\"https:\/\/support.lumerical.com\/hc\/en-us\/articles\/1500007997382-Drawing-truncated-cone-in-finite-element\" rel=\"nofollow\">https:\/\/support.lumerical.com\/hc\/en-us\/articles\/1500007997382-Drawing-truncated-cone-in-finite-element<\/a><\/p>\n<p>I understood that the command &#039;addplanarsolid&#039; requests two data i.e. vertices and facets.<\/p>\n<p>vtx = [[ 3.00000000e-06&nbsp;1.50000000e-06 -1.50000000e-06 -3.00000000e-06<\/p>\n<p>&nbsp;-1.50000000e-06&nbsp;1.50000000e-06&nbsp;1.50000000e-06&nbsp;7.50000000e-07<\/p>\n<p>&nbsp;-7.50000000e-07 -1.50000000e-06 -7.50000000e-07&nbsp;7.50000000e-07<\/p>\n<p>&nbsp;&nbsp;0.00000000e+00&nbsp;0.00000000e+00]<\/p>\n<p>&nbsp;[ 0.00000000e+00&nbsp;2.59807621e-06&nbsp;2.59807621e-06&nbsp;3.67394040e-22<\/p>\n<p>&nbsp;-2.59807621e-06 -2.59807621e-06&nbsp;0.00000000e+00&nbsp;1.29903811e-06<\/p>\n<p>&nbsp;&nbsp;1.29903811e-06&nbsp;1.83697020e-22 -1.29903811e-06 -1.29903811e-06<\/p>\n<p>&nbsp;&nbsp;0.00000000e+00&nbsp;0.00000000e+00]<\/p>\n<p>&nbsp;[-5.00000000e-06 -5.00000000e-06 -5.00000000e-06 -5.00000000e-06<\/p>\n<p>&nbsp;-5.00000000e-06 -5.00000000e-06 -5.00000000e-06 -5.00000000e-06<\/p>\n<p>&nbsp;-5.00000000e-06 -5.00000000e-06 -5.00000000e-06 -5.00000000e-06<\/p>\n<p>&nbsp;-5.00000000e-06&nbsp;5.00000000e-06]]<\/p>\n<p>&lt;class &#039;numpy.ndarray&#039;&gt;<\/p>\n<p><\/p>\n<\/p>\n<p>a = [[[2, 1, 13]], [[3, 2, 13]], [[4, 3, 13]], [[5, 4, 13]], [[6, 5, 13]], [[1, 6, 13]], [[7, 8, 14]], [[8, 9, 14]], [[9, 10, 14]], [[10, 11, 14]], [[11, 12, 14]], [[12, 7, 14]], [[1, 2, 8, 7]], [[2, 3, 9, 8]], [[3, 4, 10, 9]], [[4, 5, 11, 10]], [[5, 6, 12, 11]], [[6, 1, 7, 12]]]<\/p>\n<p>&lt;class &#039;list&#039;&gt;<\/p>\n<p><\/p>\n<\/p>\n<p>I have made the vertex and facets then I encountered the error&nbsp;<\/p>\n<p><\/p>\n<\/p>\n<p>&nbsp;&quot;File &quot;E:\/user\/\uae40\uac15\uc11d\/lumapi_example\/pyramid.py&quot;, line 121, in &lt;module&gt;<\/p>\n<p>&nbsp;&nbsp;fdtd.set(&#039;facets&#039;, a)<\/p>\n<p>lumapi.LumApiError: &quot;argument list for set command is incorrect &#8211; set arguments were converted to (&#039;str, cell array)&quot;<\/p>\n<p><\/p>\n<\/p>\n<p>So I converted arguments of facets &quot;a&quot; to nd.array and I also encountered the error like this<\/p>\n<p><\/p>\n<\/p>\n<p>&quot;E:\/user\/\uae40\uac15\uc11d\/lumapi_example\/pyramid.py:114: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify &#039;dtype=object&#039; when creating the ndarray<\/p>\n<p>&nbsp;a_array = np.array(a)<\/p>\n<p>TypeError: float() argument must be a string or a number, not &#039;list&#039;<\/p>\n<p><\/p>\n<\/p>\n<p>The above exception was the direct cause of the following exception:<\/p>\n<p><\/p>\n<\/p>\n<p>Traceback (most recent call last):<\/p>\n<p>&nbsp;File &quot;C:Program FilesLumericalv202apipythonlumapi.py&quot;, line 362, in packMatrix<\/p>\n<p>&nbsp;&nbsp;v = v.astype(dtype=&quot;float64&quot;, casting=&quot;unsafe&quot;, order=&#039;F&#039;)<\/p>\n<p>ValueError: setting an array element with a sequence.<\/p>\n<p><\/p>\n<\/p>\n<p>During handling of the above exception, another exception occurred:<\/p>\n<p><\/p>\n<\/p>\n<p>Traceback (most recent call last):<\/p>\n<p>&nbsp;File &quot;E:\/user\/\uae40\uac15\uc11d\/lumapi_example\/pyramid.py&quot;, line 121, in &lt;module&gt;<\/p>\n<p>&nbsp;&nbsp;fdtd.set(&#039;facets&#039;, a_array)<\/p>\n<p>&#8230;<\/p>\n<p>lumapi.LumApiError: &#039;Unsupported data type&#039;<\/p>\n<p><\/p>\n<\/p>\n<p>Process finished with exit code 1<\/p>\n<p><\/p>\n<\/p>\n<p>If I resolved this problem, then should I put the command &#039;a_array = fdtd.putv(&quot;a&quot;,a)&#039; like this?<\/p>\n<p><\/p>\n<\/p>\n<p>Any help would be appreciated<\/p>\n","protected":false},"template":"","class_list":["post-166360","topic","type-topic","status-closed","hentry"],"aioseo_notices":[],"acf":[],"custom_fields":[{"0":{"_btv_view_count":["1804"],"_bbp_likes_count":["0"],"_bbp_subscription":["248385","9029"],"_bbp_topic_status":["unanswered"],"_bbp_status":["publish"],"_bbp_topic_id":["166360"],"_bbp_forum_id":["27833"],"_bbp_engagement":["9029","14496","248385"],"_bbp_voice_count":["3"],"_bbp_reply_count":["4"],"_bbp_last_reply_id":["245823"],"_bbp_last_active_id":["245823"],"_bbp_last_active_time":["2023-01-07 14:50:40"]},"test":"dream98410gmail-com"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/166360","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\/166360\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=166360"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}