Opened 6 years ago
Last modified 6 years ago
#5440 new defect
visualization crash
Reported by: | Volker Waurich | Owned by: | Volker Waurich |
---|---|---|---|
Priority: | high | Milestone: | Future |
Component: | OMEdit | Version: | |
Keywords: | Cc: | Adeel Asghar, dariomangoni@… |
Description
The visualization crashes for the following model
model visShapeSTL parameter String wheelShapeFile = Modelica.Utilities.Files.fullPathName("file:///wheel.stl"); Modelica.Mechanics.MultiBody.Parts.Fixed fixed annotation( Placement(visible = true, transformation(origin = {-30, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); inner Modelica.Mechanics.MultiBody.World world annotation( Placement(visible = true, transformation(origin = {-90, 90}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); Modelica.Mechanics.MultiBody.Visualizers.Advanced.Shape vis( shapeType=wheelShapeFile, r_shape={0,0,0}, lengthDirection={1,0,0}, widthDirection={0,1,0}, length=1.0, width=1.0, height=1.0, color={0,128,255}, extra=0.0, specularCoefficient=world.defaultSpecularCoefficient, r=world.frame_b.r_0, R=world.frame_b.R) if world.enableAnimation; annotation( Placement(visible = true, transformation(origin = {12, 2}, extent = {{-10, -10}, {10, 10}}, rotation = 0))); equation annotation( uses(Modelica(version = "3.2.3"))); end visShapeSTL;
Attachments (1)
Change History (7)
by , 6 years ago
comment:1 by , 6 years ago
Cc: | added |
---|
comment:2 by , 6 years ago
Cc: | added |
---|
follow-up: 4 comment:3 by , 6 years ago
comment:4 by , 6 years ago
Replying to vwaurich:
I'm not arguing on what is the correct syntax, but on the fact that OMEdit crashes with no meaningful error.
I agree that I may have written something wrong, but it shouldn't just crash!
OMEdit crashes when parameter String wheelShapeFile =
is equal to:
Modelica.Utilities.Files.fullPathName("file:///wheel.stl")
Modelica.Utilities.Files.fullPathName("file://wheel.stl")
Modelica.Utilities.Files.fullPathName("wheel.stl")
The suggestion to use modelica://packageName/cadFile.stl
is right, but what about scripts that are not in a package? How can I solve this?
I tried with:
parameter String wheelShapeFile = "file:///wheel.stl";
returns Could not find the file /wheel.stl
parameter String wheelShapeFile = "file://wheel.stl";
returns Could not find the file wheel.stl
parameter String wheelShapeFile = "wheel.stl";
returns Unknown type wheel.stl, we make a capsule
parameter String wheelShapeFile = "./wheel.stl";
returns Unknown type ./wheel.stl, we make a capsule.
parameter String wheelShapeFile = "wheel.stl";
returns Unknown type /wheel.stl, we make a capsule.
BTW, with all these syntaxes, the Scripting Notification message is NOT output immediately after the simulation, but only after I go back to the model and save the script file!
comment:5 by , 6 years ago
Running with GDB:
Warning: The binding expression Modelica.Utilities.Files.fullPathName("files:///wheel.stl") of the visualization type component wheelShapeFile cannot be evaluated. Please specify a visualization type (CAD files are specified as modelica://packagename/filename.stl)
Running without GDB:
Limited backtrace at point of segmentation fault /lib/x86_64-linux-gnu/libc.so.6(+0x3ef20)[0x7f194353cf20] /usr/bin/../lib/x86_64-linux-gnu/omc/libOpenModelicaCompiler.so(omc_VisualXML_replaceVisualBinding+0x2ef)[0x7f19442b96fb]
The correct way to specify the path is parameter String wheelShapeFile = "wheel.stl";
assuming you run omc in that directory, or parameter String wheelShapeFile = "/home/marsj/tmp/wheel.stl"
if you run it in OMEdit or parameter String wheelShapeFile = Modelica.Utilities.Files.loadResource("modelica://visShapeSTL/wheel.stl");
if you want it to work anywhere.
fullPathName
in the ticket will not resolve any URI.
comment:6 by , 6 years ago
It's quite important that the crash is fixed, because OMEdit should never crash...
I think the file location is not given correctly. Correct me if I am wrong.
Modelica.Utilities.Files.fullPathName takes a simple file name without
file://
- prefix.Besides that, OMEdit is only capable of handling constant shapeTypes. OMC will evaluate the parameter to a constant.
I would also recommend to give the CAD-file location in the shapeType using a modelica-URL
modelica://packageName/cadFile.stl
, as this is the common way.Finally, OMC needs an ASCII-encoded stl. Binary formats are not supported.