Simscaper multibody set file solid file path to be from project folder instead of from PC

6 views (last 30 days)
Hello! I am making my first matlab project in simscape multibody and I am importing some .STEP files for my model (I am using the "file solid" block). The issue that i'm having is that I want to have the file path be set from the project folder, instead of the path directly from my computer's drive. i.e instead of "C:\Users\...\Project\CADFILE.STEP," i want to just define the path as "CADFILE.STEP". What is the best way for me to acomplish this? I have tried to look this up but the solutions don't seem to be exactly what I am looking for (I'm sorry if they are what I need, but I am very new to matlab and I have tried my best...).
Not sure if this helps, but the reason I want to do this is so that I can share the project folder to other people and have it just work.
Thanks for taking the time to help me!

Answers (1)

Sameer
Sameer on 1 Aug 2025
To use a relative path in the File Solid block in Simscape Multibody (e.g., just "CADFILE.STEP" instead of a full absolute path), make sure of the following:.
1. Create or open your project: Make sure you are working inside a MATLAB Project (use the Project tool to manage your files and folder). If you haven’t already, go to Home > New > Project > From Folder and select your project folder.
2. Put the STEP file inside the project folder: Ideally, place your CAD files inside a subfolder in the project (e.g., CAD/CADFILE.STEP).
3. Set the File Solid block path as relative: In the File Solid block, instead of using the full path, just enter the relative path from the project root, for example: CAD/CADFILE.STEP
4. Enable automatic project path management: When you run the project, MATLAB automatically adds the project root and subfolders to the path. That way, blocks that use relative paths can find the files as long as they’re inside the project structure.
Hope this helps!

Categories

Find more on Simulation and Analysis in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!