Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations MintJulep on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Femap API Error "Type mismatch"

vvk_187

Student
Dec 11, 2024
7
Hi, Where is the mistake?



Code:
 pNodeSet.AddAll(zDataType.FT_NODE);
            pNodeSet.Debug();

            int nodeCount = pNodeSet.Count();
            Console.WriteLine("nodeCount =" + nodeCount);
            Console.ReadKey();
            
            int nodeID;
            object XYZ;
            object wpXYZ;
            double[] outwpXYZ = new double[3];
            

            while (pNodeSet.Next()>0)
            {
                   nodeID = pNodeSet.CurrentID;
                   Console.WriteLine("nodeID =" + nodeID);
                   Console.ReadKey();
                    
                                    
                     pNode.Get(nodeID);
                     XYZ = pNode.xyz;
                    
                    
                    pModel.feCoordToWorkplane(XYZ, out wpXYZ);


                    outwpXYZ = (double[])wpXYZ;
                  
                  Console.WriteLine("nodeID=" + nodeID + " X=" + Math.Round(outwpXYZ[0], 2) + " Y=" + Math.Round(outwpXYZ[1], 2));
                  Console.ReadLine();
                

            }
 
Solution
Thanks for the response.
This line gave an error
pModel.feCoordToWorkplane(XYZ, out wpXYZ);
Fixed everything by adding an object variable to the loop before the function and zeroing it.
object wpXYZ=null;
The question can be considered closed
Replies continue below

Recommended for you

i'm not too versed in the C API, only femap's native BASIC and the python API, but what line is giving you the type mismatch?

also it seems this is not the full code, but an excerpt
 
Last edited:
Thanks for the response.
This line gave an error
pModel.feCoordToWorkplane(XYZ, out wpXYZ);
Fixed everything by adding an object variable to the loop before the function and zeroing it.
object wpXYZ=null;
The question can be considered closed
 
Solution

Part and Inventory Search

Sponsor