{"id":3950,"date":"2021-07-26T21:09:16","date_gmt":"2021-07-26T13:09:16","guid":{"rendered":"http:\/\/pipingpig.com\/index.php\/2021\/07\/26\/smart3d-0184\/"},"modified":"2026-08-20T19:03:19","modified_gmt":"2026-08-20T11:03:19","slug":"smart3d-0184","status":"publish","type":"post","link":"https:\/\/www.pipingpig.com\/index.php\/2021\/07\/26\/smart3d-0184\/","title":{"rendered":".NET API Error when Copying Imported Shape as Generic Shape"},"content":{"rendered":"<div class=\"content\">\n<p><img decoding=\"async\" data-ratio=\"0.8988095238095238\" data-src=\"https:\/\/www.pipingpig.com\/wp-content\/uploads\/2026\/08\/0184_img_0000.png\" data-type=\"png\" data-w=\"504\" src=\"https:\/\/www.pipingpig.com\/wp-content\/uploads\/2026\/08\/0184_img_0000.png\" \/><\/p>\n<p>\u8be6\u7ec6\u4fe1\u606f<\/p>\n<p>Knowledge Detail<\/p>\n<p>\u6807\u9898<\/p>\n<p>.NET API Error when Copying Imported Shape as Generic Shape<\/p>\n<p>\u5bf9\u5ba2\u6237\u53ef\u89c1<\/p>\n<p>\u6587\u7ae0\u8bb0\u5f55\u7c7b\u578b<\/p>\n<p>Support<\/p>\n<p>Issue<\/p>\n<p>User can insert a .dgn or .sat file using Place Imported Shape from File command in Equipment &amp; Furnishings task. This creates a shape object under the selected Equipment. Using .NET API, when user tries to copy this imported shape using a copy constructor of GenericShape class, the following exception is thrown.<\/p>\n<p>Sample Code:<\/p>\n<p>Dim oShape As GenericShape<\/p>\n<p>\u2018 TODO: initialise the object to the Imported shape object that needs to be copied<\/p>\n<p>Dim oNewShape As New GenericShape(oShape) \u2018exception is thrown at this line of code<\/p>\n<p>Exception Message:<\/p>\n<p>Unexpected failure in constructing the .NET object<\/p>\n<p>Environment<\/p>\n<p>Smart 3D version 2014 R1 and earlier<\/p>\n<p>Resolution<\/p>\n<p>Use the following sample code as the workaround to copy the imported shape. Get the filepath of the imported shape file and give that path as input to the GenericShape constructor to create a copy of it. Make sure that the corresponding file exists in the filepath location.<\/p>\n<p>Dim oDestinationEqp As Equipment<\/p>\n<p>\u2018TODO: initialise the object with the Equipment object<\/p>\n<p>Dim sFilePath As String = oShape.GetPropertyValue(&#8220;IJUAImportedShape&#8221;, &#8220;FilePath&#8221;).ToString()<\/p>\n<p>Dim oNewShape As New GenericShape(oDestinationEqp, sFilePath)<\/p>\n<p>oNewShape.Origin = oPosition<\/p>\n<p>&#8216;TODO: initialise oPosition variable to the required position in the 3D model<\/p>\n<p>ClientServiceProvider.TransactionMgr.Commit(&#8220;Copy Imported Shape&#8221;)<\/p>\n<p>Cause<\/p>\n<p>API limitation<\/p>\n<p><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u8be6\u7ec6\u4fe1\u606f Knowledge Detail \u6807\u9898 .NET API Error when Copying Im [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3949,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"categories":[9,28,18],"tags":[],"class_list":["post-3950","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-smart3d","category-dev","category-18"],"_links":{"self":[{"href":"https:\/\/www.pipingpig.com\/index.php\/wp-json\/wp\/v2\/posts\/3950","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pipingpig.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pipingpig.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pipingpig.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pipingpig.com\/index.php\/wp-json\/wp\/v2\/comments?post=3950"}],"version-history":[{"count":3,"href":"https:\/\/www.pipingpig.com\/index.php\/wp-json\/wp\/v2\/posts\/3950\/revisions"}],"predecessor-version":[{"id":7864,"href":"https:\/\/www.pipingpig.com\/index.php\/wp-json\/wp\/v2\/posts\/3950\/revisions\/7864"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.pipingpig.com\/index.php\/wp-json\/wp\/v2\/media\/3949"}],"wp:attachment":[{"href":"https:\/\/www.pipingpig.com\/index.php\/wp-json\/wp\/v2\/media?parent=3950"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pipingpig.com\/index.php\/wp-json\/wp\/v2\/categories?post=3950"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pipingpig.com\/index.php\/wp-json\/wp\/v2\/tags?post=3950"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}