Opened 5 years ago

Last modified 3 years ago

#5953 assigned defect

Broken visualization code generation for models with components having same name

Reported by: anonymous Owned by: Volker Waurich
Priority: high Milestone:
Component: Code Generation Version:
Keywords: Cc:

Description

Model VisualizationBug has two shapes with the same name body.sphere and foo.body.sphere and body.sphere is missing from 3D animation scene in OMEdit.

model VisualizationBug
  model Foo
    Modelica.Mechanics.MultiBody.Parts.Body body(
      angles_fixed = true, m = 1, r_CM = {0, 0, 0},
      r_0(each fixed = true, start = {0, 0, 0}),
      v_0(each fixed = true), w_0_fixed = true
    );
  end Foo;

  Modelica.Mechanics.MultiBody.Parts.Body body(
    angles_fixed = true, m = 1,
    r_0(each fixed = true, start = {0, 1, 0}), 
    r_CM = {0, 0, 0}, v_0(each fixed = true), w_0_fixed = true);
  
  inner Modelica.Mechanics.MultiBody.World world;
  
  VisualizationBug.Foo foo;
end VisualizationBug;

I think that's because compiler generates wrong *_vis.xml file and shape body.sphere use foo.body.sphere parameters.

<shape>
  <ident>body.sphere</ident>
  <type>sphere</type>
  <T>
    <cref>foo.body.sphere.R.T[1,1]</cref>
    <cref>foo.body.sphere.R.T[1,2]</cref>
    <cref>foo.body.sphere.R.T[1,3]</cref>
    <cref>foo.body.sphere.R.T[2,1]</cref>
    <cref>foo.body.sphere.R.T[2,2]</cref>
    <cref>foo.body.sphere.R.T[2,3]</cref>
    <cref>foo.body.sphere.R.T[3,1]</cref>
    <cref>foo.body.sphere.R.T[3,2]</cref>
    <cref>foo.body.sphere.R.T[3,3]</cref>
  </T>
  <r>
    <cref>foo.body.sphere.r[1]</cref>
    <cref>foo.body.sphere.r[2]</cref>
    <cref>foo.body.sphere.r[3]</cref>
  </r>
  <r_shape>
    <cref>foo.body.sphere.r_shape[1]</cref>
    <cref>body.sphere.r_shape[2]</cref>
    <cref>body.sphere.r_shape[3]</cref>
  </r_shape>
  ...
</shape>

Change History (7)

comment:1 by anonymous, 5 years ago

Visualization works correctly if VisualizationBug.Foo foo moved above Modelica.Mechanics.MultiBody.Parts.Body body.

model VisualizationBug 
   model Foo
    Modelica.Mechanics.MultiBody.Parts.Body body(
      angles_fixed = true, m = 1, r_CM = {0, 0, 0},
      r_0(each fixed = true, start = {0, 0, 0}),
      v_0(each fixed = true), w_0_fixed = true
    );
  end Foo;
  VisualizationBug.Foo foo;

  Modelica.Mechanics.MultiBody.Parts.Body body(
    angles_fixed = true, m = 1,
    r_0(each fixed = true, start = {0, 1, 0}), 
    r_CM = {0, 0, 0}, v_0(each fixed = true), w_0_fixed = true);
  
  inner Modelica.Mechanics.MultiBody.World world;
end VisualizationBug;

comment:2 by Francesco Casella, 5 years ago

Component: Code GenerationOMEdit
Milestone: Future1.17.0
Owner: changed from Lennart Ochel to Adeel Asghar
Status: newassigned

comment:3 by Adeel Asghar, 5 years ago

The file model_vis.xml is generated by the compiler when setCommandLineOptions("-d=visxml") is set.

This seems like code generation issue. OMEdit just reads the file and creates the OSG objects accordingly.

comment:4 by Francesco Casella, 5 years ago

@adeas31, can you please reassign it to someone that can help with that?

comment:5 by Adeel Asghar, 5 years ago

Component: OMEditCode Generation
Owner: changed from Adeel Asghar to Volker Waurich

Volker implemented that but I am not sure who else can take care of this.

comment:6 by Francesco Casella, 4 years ago

Milestone: 1.17.01.18.0

Retargeted to 1.18.0 because of 1.17.0 timed release.

comment:7 by Francesco Casella, 3 years ago

Milestone: 1.18.0

Ticket retargeted after milestone closed

Note: See TracTickets for help on using tickets.