How can I import CAD geometry from SimWise4D?

3 Ansichten (letzte 30 Tage)
Kudakwashe
Kudakwashe am 12 Jun. 2025
Beantwortet: Shishir Reddy am 26 Jun. 2025
i am getting this error when using the get geometry app
Cell contents reference from a non-cell array object.
Error in cell2mat (line 42)
cellclass = class(c{1});
Error in GetSimWiseCGFrame (line 8)
cog = cell2mat(cog);
Error in GetAssemblyBodiesFromSimWise (line 22)
Frames(BodyCount) = GetSimWiseCGFrame( Frames(BodyCount), body );
Error in GetAssemblies>GetSimWiseAssembliesAndBodies (line 32)
[BodyCount, AssemblyStructure, Frames, Joints, Bodies, GroundedFrames, JointCount] =
GetAssemblyBodiesFromSimWise(assem, AssemblyStructure, AssemblyIndices, Frames, Joints, Bodies,
GroundedFrames, BodyCount, JointCount, SimWiseObject );
Error in GetAssemblies (line 20)
[~, RootAssembly, Frames, Joints, Bodies, GroundedFrames, JointCount] =
GetSimWiseAssembliesAndBodies(swroot, RootAssembly, AssemblyIndices, Frames, Joints, Bodies,
GroundedFrames, BodyCount, JointCount, SimWiseObject );
Error in CreateBodiesJointsAndFramesStructuresFromSimWiseModel (line 119)
[Assemblies, Frames, Joints, Bodies, Gears, PointToPoints, Loads, Motors, ActuatedPrismatics,
CurvedSlotJoints, GroundedFrames] = GetAssemblies( SimWiseObject, Frames, Joints, Bodies, Gears,
PointToPoints, Loads, Motors, ActuatedPrismatics, CurvedSlotJoints, GroundedFrames );
Error in ConnectToSimWiseGetDataAndBuildMechanicalModels2 (line 10)
[Assemblies, Bodies, Joints, Gears, PointToPoints, Loads, Motors, ActuatedPrismatics,
CurvedSlotJoints, Frames, GroundedFrames, AdditionalFrames, Curves] =
CreateBodiesJointsAndFramesStructuresFromSimWiseModel( SimWiseObject );
Error in GetGeometryGUI>pushbutton2_Callback (line 113)
ConnectToSimWiseGetDataAndBuildMechanicalModels2( SimWiseObject, callSimMechanicsAndWriteMGFile012, 1
);
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in GetGeometryGUI (line 44)
gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)GetGeometryGUI('pushbutton2_Callback',hObject,eventdata,guidata(hObject))

Antworten (1)

Shishir Reddy
Shishir Reddy am 26 Jun. 2025
As per my understanding, you are enountering the following the error while running the code.
Cell contents reference from a non-cell array object.
Error in cell2mat (line 42)
cellclass = class(c{1});
Error in GetSimWiseCGFrame (line 8)
cog = cell2mat(cog);
This suggests that the variable 'cog' is expected to be a cell array, but it's actually a different data type (e.g., a structure, numeric array, or string). Which implies that the following line is causing the issue -
cog = cell2mat(cog);
Kindly refer the following troubleshooting steps to resolve the problem:
1. Check the type of 'cog' before calling 'cell2mat'
Add a debugging statement before line 8 in 'GetSimWiseCGFrame.m'
disp(class(cog));
2. Verify the data returned from SimWise:
If 'cog' is being returned from a SimWise API or function, ensure that the API is returning it as a cell array, or adjust the code to handle the actual format appropriately.
3. Modify the code if necessary:
If 'cog' is already a numeric vector and not a cell, 'cell2mat' is not needed. So, that conversion step can be skipped.
I hope this resolves the issue.

Kategorien

Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange

Produkte


Version

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by