Thanks. I looked in to the snippets. I found some useful snippet codes.
But, I can't get around with what I need.
Upon creation, I need to have the option to select the template (sheet or part) - Could you fix? Sorry for bothering you. Thanks a lot.
Dim iLNO As String = "0001P"
oPath_and_FileName = ThisDoc.PathAndFileName(False) ' without extension
oQuestion = MessageBox.Show("Do you want to derive this file?", iLNO, MessageBoxButtons.YesNo)
If oQuestion = vbNo Then
Return
Else
' Create a new part file to derive the selected part into
'note: kPartDocumentObject is the default template
Dim oPartDoc As PartDocument
oPartDoc = ThisApplication.Documents.Add(kPartDocumentObject, ThisApplication.FileManager.GetTemplateFile(kPartDocumentObject))
'Create a derived definition for the selected part
Dim oDerivedPartDef As DerivedPartUniformScaleDef
oDerivedPartDef = oPartDoc.ComponentDefinition.ReferenceComponents.DerivedPartComponents.CreateUniformScaleDef(ThisDoc.PathAndFileName(True))
' set the scale to use
oDerivedPartDef.ScaleFactor = 1
'define the mirror plane
'kDerivedPartMirrorPlaneXY = 27393
'kDerivedPartMirrorPlaneYZ = 27394
'kDerivedPartMirrorPlaneXZ = 27395
oDerivedPartDef.MirrorPlane = 27394
' Create the derived part.
oPartDoc.ComponentDefinition.ReferenceComponents.DerivedPartComponents.Add(oDerivedPartDef)
' Save the new derived part.
oPartDoc.SaveAs(oPath_and_FileName & "_derived.ipt", False)
oPartDoc.Close
MessageBox.Show("New file created at:" & vbLf & oPath_and_FileName & "_derived.ipt", iLNO)
End If