How to refer nodes of other segment?

Hi,

I have a simple question. please show my picture attached.

I made 2 segments and 1 node per segment.

I want to express or refer node 2 in seg1 folder. I made a same node , named node_ref like below.

AnySeg seg1 =
{

    Mass = 1;
    Jii = {0.001, 0.001, 0.0001};
    
    AnyDrawSeg drw = {};
    AnyRefNode node1 = {
      sRel = {0.02, 0, 0};
      AnyDrawRefFrame drw = {};
    
    };
    
    AnyRefNode node_ref = {
      
      sRel = ..test2.r0+.node1.sRel;
      AnyDrawRefFrame drw = {};
    };
  };
  
  
   AnySeg seg2 = 
  {
    r0 = {0.1, 0, 0};
    
    Mass = 1;
    Jii = {0.001, 0.001, 0.0001};
   
    AnyDrawSeg drw = {};
    AnyRefNode node2 = {
      sRel = {0.02, 0, 0};
      AnyDrawRefFrame drw = {};
    
    };

  };

is there any easy way to refer or express the node of other segment?

thank you for your answer in advance

Hi,

Your code seems to be correct and this is the way we refer to other objects most of the time - by either finding a relative path to the object or by using references:


AnySeg Seg1 = {
  AnySeg &ref = ..somepathhere..Seg2;
  AnyNode node_ref = {
    sRel = .ref.sRel;
  };
};

I don’t think I can suggest any better shortcuts.

One more thing - please keep in mind that sRel is a static member of the AnyRefNode object and does not change with time, so it cannot use time-dependent value in the expression, for example, .r.

Hope this helps. And if not - could you describe what you are trying to do exactly?

Kind regards,
Pavel