
详细信息
Knowledge Detail
标题
.NET API Error when Copying Imported Shape as Generic Shape
对客户可见
文章记录类型
Support
Issue
User can insert a .dgn or .sat file using Place Imported Shape from File command in Equipment & 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.
Sample Code:
Dim oShape As GenericShape
‘ TODO: initialise the object to the Imported shape object that needs to be copied
Dim oNewShape As New GenericShape(oShape) ‘exception is thrown at this line of code
Exception Message:
Unexpected failure in constructing the .NET object
Environment
Smart 3D version 2014 R1 and earlier
Resolution
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.
Dim oDestinationEqp As Equipment
‘TODO: initialise the object with the Equipment object
Dim sFilePath As String = oShape.GetPropertyValue(“IJUAImportedShape”, “FilePath”).ToString()
Dim oNewShape As New GenericShape(oDestinationEqp, sFilePath)
oNewShape.Origin = oPosition
‘TODO: initialise oPosition variable to the required position in the 3D model
ClientServiceProvider.TransactionMgr.Commit(“Copy Imported Shape”)
Cause
API limitation

您需要登录 或注册 后才可以发表评论。