Author Topic: Resizable pipe shape script  (Read 8113 times)

Glassboy

  • EA Practitioner
  • ***
  • Posts: 1367
  • Karma: +112/-75
    • View Profile
Resizable pipe shape script
« on: October 01, 2018, 09:24:56 am »
Does anyone have a resizable pipe shape script like the Visio network icon?

If so can you post it here as I can't reach a lot of the file sharing sites from my work network.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8083
  • Karma: +118/-20
    • View Profile
Re: Resizable pipe shape script
« Reply #1 on: October 01, 2018, 11:05:18 am »
You mean a cylinder?

Code: [Select]
shape main
{
setfixedregion(0,0,0,20);
startpath();
moveto(0,10);
setfixedregion(0,80,0,100);
lineto(0,90);
arcto(0,80,100,100,0,90,100,90);
setfixedregion(0,0,0,20);
lineto(100,10);
endpath();
FillAndStrokePath();

ellipse(0,0,100,20);
addsubshape("top",0,0,100,20);
}

Changing the height of your object changes the length of the pipe. Changing the width changes the view angle.

Glassboy

  • EA Practitioner
  • ***
  • Posts: 1367
  • Karma: +112/-75
    • View Profile
Re: Resizable pipe shape script
« Reply #2 on: October 01, 2018, 12:51:02 pm »
Hmmm yes but going the other way.  That looks like a database :-)

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8083
  • Karma: +118/-20
    • View Profile
Re: Resizable pipe shape script
« Reply #3 on: October 01, 2018, 03:23:34 pm »
Hmmm yes but going the other way.  That looks like a database :-)
Which other way? I can think of three obvious ones.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8083
  • Karma: +118/-20
    • View Profile
Re: Resizable pipe shape script
« Reply #4 on: October 01, 2018, 03:41:04 pm »
Bottom
Code: [Select]
shape main
{
setfixedregion(0,80,0,100);
startpath();
moveto(100,90);
setfixedregion(0,0,0,20);
arcto(0,00,100,20,100,10,0,10);
setfixedregion(0,80,0,100);
lineto(0,90);
endpath();
FillAndStrokePath();

ellipse(0,80,100,100);
}

Left
Code: [Select]
shape main
{
setfixedregion(0,0,20,0);
startpath();
moveto(10,100);
setfixedregion(80,0,100,0);
arcto(80,0,100,100,90,100,90,0);
setfixedregion(0,0,20,0);
lineto(10,0);
endpath();
FillAndStrokePath();

ellipse(0,0,20,100);
}

Right
Code: [Select]
shape main
{
setfixedregion(80,0,100,0);
startpath();
moveto(90,0);
setfixedregion(0,0,20,0);
arcto(0,0,20,100,10,0,10,100);
setfixedregion(80,0,100,0);
lineto(90,100);
endpath();
FillAndStrokePath();

ellipse(80,0,100,100);
}

Note: I removed the redundant lineto from before arcto in these scripts.

I just noticed that the arc portion of the script doesn't appear to obey the fixed region. To get it working nicely you would convert the scripts to use two bezier sections.
« Last Edit: October 01, 2018, 03:59:50 pm by Simon M »

Glassboy

  • EA Practitioner
  • ***
  • Posts: 1367
  • Karma: +112/-75
    • View Profile
Re: Resizable pipe shape script
« Reply #5 on: October 02, 2018, 07:19:36 am »
Thanks.  Right looks best with the existing deployment view shapes.  I noticed in the example you use an unspecialised node resized to be a rectangle but it doesn't look that great or really fit in on a nice tidy diagram :-)

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8083
  • Karma: +118/-20
    • View Profile
Re: Resizable pipe shape script
« Reply #6 on: October 02, 2018, 05:16:02 pm »
Here's a version of right where the left edge scales in the same way as the right.

Code: [Select]
shape main
{
setfixedregion(80,0,100,0);
startpath();
moveto(90,0);
setfixedregion(0,0,20,0);
//arcto(0,0,20,100,10,0,10,100);
lineto(10,0);
bezierto(4,0,0,28,0,50);
bezierto(0,72,4,100,10,100);
setfixedregion(80,0,100,0);
lineto(90,100);
endpath();
FillAndStrokePath();

ellipse(80,0,100,100);
}

Glassboy

  • EA Practitioner
  • ***
  • Posts: 1367
  • Karma: +112/-75
    • View Profile
Re: Resizable pipe shape script
« Reply #7 on: October 03, 2018, 07:57:56 am »
Something about that approach makes the name subshape I added print at top left.  Any idea what?

Code: [Select]
AddSubShape("name", "center");
text name
{
h_align = "center";
v_align = "center";
        PrintWrapped("#NAME#");
   }
}

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8083
  • Karma: +118/-20
    • View Profile
Re: Resizable pipe shape script
« Reply #8 on: October 03, 2018, 09:25:54 am »
I'd say that when you copied the rest of my script you lost the following from the top of your script.

Code: [Select]
layouttype="border";
I would also add the following to center the text within the face.
Code: [Select]
AddSubShape("padding","e");
shape padding
{
    preferredWidth=20;
}
« Last Edit: October 03, 2018, 09:30:56 am by Simon M »

Glassboy

  • EA Practitioner
  • ***
  • Posts: 1367
  • Karma: +112/-75
    • View Profile
Re: Resizable pipe shape script
« Reply #9 on: October 03, 2018, 10:28:43 am »
I'd say that when you copied the rest of my script you lost the following from the top of your script.
Code: [Select]
layouttype="border";

Ahh yes, obviously. Thanks.

I've been busy translated Visio fruit salad into proper deportment diagrams so it's been a bit hard to get my head properly into shape script mode. :-)

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8607
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Resizable pipe shape script
« Reply #10 on: October 03, 2018, 04:43:36 pm »
I'd say that when you copied the rest of my script you lost the following from the top of your script.
Code: [Select]
layouttype="border";

Ahh yes, obviously. Thanks.

I've been busy translated Visio fruit salad into proper deportment diagrams so it's been a bit hard to get my head properly into shape script mode. :-)
OK, I'll bite... What's a deportment diagram?   ;) ;)

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Resizable pipe shape script
« Reply #11 on: October 03, 2018, 05:57:23 pm »
Try Google it has lots of colored pictures.

q.

Glassboy

  • EA Practitioner
  • ***
  • Posts: 1367
  • Karma: +112/-75
    • View Profile
Re: Resizable pipe shape script
« Reply #12 on: October 04, 2018, 06:08:57 am »
OK, I'll bite... What's a deportment diagram?   ;) ;)

It's an orderly deployment diagram.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8607
  • Karma: +257/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Resizable pipe shape script
« Reply #13 on: October 04, 2018, 08:38:15 am »
OK, I'll bite... What's a deportment diagram?   ;) ;)

It's an orderly deployment diagram.
Does it have a "book" widget at the top to ensure it's smooth passage?

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Glassboy

  • EA Practitioner
  • ***
  • Posts: 1367
  • Karma: +112/-75
    • View Profile
Re: Resizable pipe shape script
« Reply #14 on: October 04, 2018, 11:40:12 am »
Does it have a "book" widget at the top to ensure it's smooth passage?

I'm telling you man, I'm blowing vendor diagrams up to 300% to work out where their lines are running.  I'm on the edge.