I am trying to copy a model from another design file using code. If I record this process, I get this
CadInputQueue.SendCommand("model import " & FileName & Modelname)
I would like to use something like
dim mdlNew as Attachment
dim att as attachment
mdlNew = MsApp.ActiveDesignFile.Models.Copy(att, modelname, modeldescription)
but I am having a difficult time assigning a file name to the attachment(att)
The code snip below shows how to copy a model from an external design file to the active design file (and model)
Sub WorkDgnModelImport()
Dim oDestModel As ModelReferenceDim oSrcModel As ModelReferenceDim oDestDesignFile As DesignFileDim oSrcDesignFile As DesignFileDim strFileToImport As String' Configure destination design file and model to write toSet oDestDesignFile = ActiveDesignFileSet oDestModel = ActiveDesignFile.Models("Default")' Configure source design file and model to read fromstrFileToImport = "C:\temp\dms18779\3d.dgn"Set oSrcDesignFile = OpenDesignFileForProgram(strFileToImport, False)Set oSrcModel = oSrcDesignFile.Models("Default")' Perform copy from source model to destintation model - active modeloDestDesignFile.Models.Copy oSrcModel, "ImportedModel-1"' CleanupoSrcDesignFile.Close
End SubHTH,Bob
Answer Verified By: SteveMeyer
Bob, you are a prince among men. Thanks