form runtime error

form runtime error

joe_hancockRLPXP
Explorer Explorer
562 Views
4 Replies
Message 1 of 5

form runtime error

joe_hancockRLPXP
Explorer
Explorer

I'm trying to create a form in Visual Studio that allows user input to create a cylinder by adding the radius, x and y coordinates, and then extrude distance but after hitting the create button on the form i get the error 'System.MissingMemberException: 'Public member 'ComponentDefintion' on type 'PartDocument' not found.'

 

what could be the problem

 

 

Imports Inventor

 

Public Class shapecreaterform

Private Sub Btn_Create_Click(sender As Object, e As EventArgs) Handles Btn_Create.Click


Dim radius As Double = Txt_radius.Text
Dim xCoord As Double = Txt_X.Text
Dim yCoord As Double = Txt_Y.Text
Dim extrudeDistance As Double = Txt_ExtrudeDistance.Text

 

Dim oTG As TransientGeometry = g_inventorApplication.TransientGeometry

 

'Dim oDoc As PartDocument = g_inventorApplication.ActiveDocument


Dim oPartDoc As PartDocument = g_inventorApplication.Documents.Add(DocumentTypeEnum.kPartDocumentObject, g_inventorApplication.FileManager.GetTemplateFile(DocumentTypeEnum.kPartDocumentObject))
Dim oCompDef As PartComponentDefinition = oPartDoc.ComponentDefintion

 

Dim oSketch As PlanarSketch = oCompDef.Sketches.Add(oCompDef.WorkPlanes(2))

 

Dim centerPoint As Point2d = oTG.CreatePoint2d(xCoord, yCoord)

 

Dim circle As SketchCircle = oSketch.SketchCircles.AddByCenterRadius(centerPoint, radius)

 

Dim oProfile As Profile = oSketch.Profiles.AddForSolid

 

Dim oExtrudeDef As ExtrudeDefinition = oCompDef.Features.ExtrudeFeatures.CreateExtrudeDefinition(oProfile, PartFeatureOperationEnum.kJoinOperation)

 

oExtrudeDef.SetDistanceExtent(extrudeDistance, PartFeatureExtentDirectionEnum.kPositiveExtentDirection)

Dim oExtrude As ExtrudeFeature = oCompDef.Features.ExtrudeFeatures.Add(oExtrudeDef)

 

End Sub
End Class

 

 

Any help would be appreciated 

 

thanks

0 Likes
Accepted solutions (1)
563 Views
4 Replies
Replies (4)
Message 2 of 5

A.Acheson
Mentor
Mentor

(I) see a spelling mistake on this line, so the error message is accurate. Happens to us all, pesky letters. 

Dim oCompDef As PartComponentDefinition = oPartDoc.ComponentDefintion

 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 3 of 5

joe_hancockRLPXP
Explorer
Explorer

Thanks for the response but I'm still having issues. Everything I've checked seems to be spelled right. Unless i'm missing something obvious.

 

Thanks,

Joe

0 Likes
Message 4 of 5

A.Acheson
Mentor
Mentor
Accepted solution

I did not test the code but the letter I was missing from the word  ComponentDefinition. 

 

Corrected line. 

Dim oCompDef As PartComponentDefinition = oPartDoc.ComponentDefinition

 

Have you received other error messages? 

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 5 of 5

joe_hancockRLPXP
Explorer
Explorer

Thank you so much. It works now after correcting the spelling. I think it's time I increase font size.

 

Thanks,

Joe

 

 

0 Likes