- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello There,
I am busy converting one of my AddIns to C# (from VB.net). I am relatively new to C#. Below are two excerpts of code, the VB code works fine, but the C# code breaks down. Any advice / help would be sincerely appreciated.
VB.net
Dim Radius, viewscale As Double
Dim oTG As TransientGeometry
Dim oCenterPoint As Point2d
oSelectSet = g_inventorApplication.ActiveDocument.SelectSet
oTG = g_inventorApplication.TransientGeometry
For Each oSelectedObject In oSelectSet
If TypeName(oSelectedObject) = "DrawingCurveSegment" Then
oDrawingCurveSegment = oSelectedObject
If oDrawingCurveSegment.GeometryType = Curve2dTypeEnum.kCircleCurve2d Then
Radius = oDrawingCurveSegment.Geometry.Radius
viewscale = oDrawingCurveSegment.Parent.Parent.Scale
oCenterPoint = oTG.CreatePoint2d(oDrawingCurveSegment.Geometry.Center.X, oDrawingCurveSegment.Geometry.Center.Y)
c#
double radius,viewscale;
Point2d oCenterPoint;
foreach (Object oSelectedObject in oSelectSet)
{
if (Information.TypeName(oSelectedObject) == "DrawingCurveSegment")
{
oDrawingCurveSegment = (DrawingCurveSegment)oSelectedObject;
if (oDrawingCurveSegment.GeometryType == Curve2dTypeEnum.kCircleCurve2d)
{
radius = oDrawingCurveSegment.Geometry.Radius;
viewscale = oDrawingCurveSegment.Parent.Parent.Scale;
oCenterPoint = oTG.CreatePoint2d(oDrawingCurveSegment.Geometry.Center.X, oDrawingCurveSegment.Geometry.Center.Y);
Error message/s:
Severity Code Description Project File Line Suppression State
Error CS1061 'object' does not contain a definition for 'Radius' and no extension method 'Radius' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?) DowelSymbolCS C:\Users\Rob\Documents\Visual Studio 2015\Projects\DowelSymbolCS\DowelSymbolCS\DowelHoleCommand.cs 119 Active
Severity Code Description Project File Line Suppression State
Error CS1061 'object' does not contain a definition for 'Center' and no extension method 'Center' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?) DowelSymbolCS C:\Users\Rob\Documents\Visual Studio 2015\Projects\DowelSymbolCS\DowelSymbolCS\DowelHoleCommand.cs 121 Active
Thanks very much
Rob
-------------------------------------------
Windows 7 Pro (X64)
Intel(R) core (TM) i5-4690 CPU @ 3.50GHz
32.0 GB RAM
Nvidia Quadro K2000
Autodesk Inventor 2015 Professional Ultimate Design Suite
Solved! Go to Solution.