API - C# - HoleRecognitionCylinders

API - C# - HoleRecognitionCylinders

maurizio_manzi
Advocate Advocate
285 Views
1 Reply
Message 1 of 2

API - C# - HoleRecognitionCylinders

maurizio_manzi
Advocate
Advocate

Hello,

does someone have an example for using HoleRecognitionCylinders() in a C# project ?

In VBA works fine:

Dim myModels As FMModels
Set myModels = doc.surfaces.HoleRecognitionCylinders(false, true)
But in C# I get an error message (...HoleRecognitionCylinders can't be used as a method...) for this code:
FMModels myModels
myModels = doc.surfaces.HoleRecognitionCylinders(false, true)
 
And next, in VBA I check if surface is a cylinder:
Dim myModel as FMModel
For Each myModel in myModels
If( TypeName(surf) = "IFMSurfaceCylinder") Then
...
 
But in C# we have not TypeName()
 
Best regards
Maurizio Manzi
Auron GmbH
 
0 Likes
286 Views
1 Reply
Reply (1)
Message 2 of 2

craig.shipley
Autodesk Support
Autodesk Support

For the purpose of the forum post (for other interested people):

The solution(s) here:

 

  1. We must use [ ] istead of ( ), because . HoleRecognitionCylinders is not a method, it is a collection, so correct is:

 

Private void RecognizeCylinders()
{
  Foreach (FMSetup setup in doc.setups
  {
    Foreach(FMModel model in doc.surfaces.HoleRecognitionCylinders[false, true, 999888777] // <<<<<< *** with [ ]  instead of ( ) ***
    {
      //do something
    }
  }
}

 

And the second part....

If (surf is IFMSurfaceCylinder)

0 Likes