Custom Line Pattern with Multiple Colors?

Started by david, July 18, 2008, 10:38:14 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

david

what i want to do is three lines one under the other (very close to each other so they all look like one thick line) so that the middle line is colored in black and the other two in yellow.  i did 3 Geometry sections in the shapesheet for each line but the LineColor cell change the color of all the 3 lines.  how can i make the lines in the colors i wanted?

thanks in advance
David

wapperdude

#1
Hello David --

If you don't care about preserving the line behavior, you can just place two lines on top of each other, make the bottom one fatter and yellow.  Then, you can group them.  But, if you want to preserve the 1D line behavior, then you can do the same thing, but don't group the lines.  Instead, check out these sites on creating custom line shapes:  http://msdn.microsoft.com/en-us/library/aa200997(office.10).aspx and John Goldsmith's http://visualsignals.typepad.co.uk/vislog/2008/03/creating-random.html.  John's contribution is actually done in two parts, I've only listed the 1st.  Oh, to avoid the fatter line ends from protruding beyond the thinner line, you might wish to change the line ends to square:  (menu bar)>Line ends>more line ends>cap.

Hope this helps.
Wapperdude
Visio 2019 Pro

david

#2
thank you for your answer.
the first link you gave me was very helpful and i really succeeded to do what i wanted by using line patterns. 
but i still have one problem.  i want the user to be able to change the line colors (both the yellow and black lines).  but by the link you gave me, the user can change only the black line by setting the line color of his shape to whatever color he wants.  but the yellow color cannot be changed.  how can i let the user change the color of the yellow lines also?

david

#3
I have another problem:

I built the line pattern I described earlier (and called it "halo") and i also made a custom property named "halo" which is boolean.  i want that whenever the user chooses halo=true in custom properties the line pattern will be halo, and whenever he chooses halo=false the line pattern will be the same as always (which is 1).

So I wrote the following command in the scratch section cell A:

=IF(Prop.halo=TRUE,SETF(GetRef(LinePattern),USE("halo")),SETF(GetRef(LinePattern),1))+DEPENDSON(Prop.halo)

but for some reason it doesn't work.  the line pattern remains 1 in any case (even if the user changes halo to true).  it will change to the pattern i want only if i change linepattern manually to USE("halo").

However, the following commad (which is very similar) does work (it's also in the scratch section):
=IF(Prop.halo=TRUE,SETF(GetRef(LineWeight),15 pt),FALSE)+DEPENDSON(Prop.halo)

it makes the line thick whenever the user chooses halo=true (because I want the user to be able to see all three colors) and does nothing if the user chooses false.

So anyone knows why the first command didn't work?

thanks in advance
David

Visio Guy

#4
Hi David,

The feature of custom patterns whereby the bits you color black then take the color of the shape is already a "bonus feature" - it offers the flexibility that a custom pattern can change color according to a user's preference.

You're asking for a feature that even a regular shape doesn't have: multiple colors on a single line. This can't be achieved without grouping several shapes together.

Likewise, with custom patterns. There is no easy way to allow end-users to give a single, custom line pattern multiple colors.
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

Visio Guy

#5
David,

Regarding the USE function, why not put the formula directly in the LinePattern cell, instead of blasting SETFs all over the place?

Or, make two User-defined cells for two different patterns (using USE), then have the LinePattern cell refer to those cells using an IF statement?

I've had mixed results with indirection and the USE function--haven't fully figured it out what the limitations are. The USE function seems to work best when it is directly in a cell that is intended for patterns.

For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

david

#6
i'm not sure i understood what you said.
the reason i didn't write USE("halo") directly in the LinePattern cell is that the default pattern should be 1.  i don't want the line to be halo immediately after the user drops the line from the stencil to the frame.

and to tell you the truth i don't really know what user-defined cells are for.  if they are for calculations then i use scratch section.

i'm blasting "SETF" and "dependson" function all over the place (and i used them ALOT) because it's the only way i know to change a cell as a reasult of an event.  so every time the user changes the coordinates or the color of a shape in the custom properties i want the shape to be updated accordingly so i used SETF and dependson.  it's really isn't convenient but it's the only way i know.  if you know a better way please tell me.

anyway, i tried to do what you told me to do (if i understood you correctly) and i wrote directly in the LinePattern cell the command "=IF(Prop.halo=TRUE,USE("halo"),1)".  still didn't work.  so please tell me what i did wrong.

about grouping shapes.  what exatcly should i group? the yellow line and the black line? and wouldn't it interfere later when the end-user groups the shapes on the frame?  visio will think that the black line and the yellow line are two different shapes in the group?

vojo

#7
check out the isometric stencil from June the second  (google "visio isometric")
His connectors have lots and lots of power...but one of them is the basis for what you want to do with color
(just unguard his background line and set thickness as you wish).

Visio Guy

#8
There's more discussion about this topic in this thread: http://visguy.com/vgforum/index.php?topic=148.0

There's even a download that shows an example of custom fill patterns changing when the text of the shape changes:
Select Smart Patterns.zip
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

david

hi visio guy,
i looked at the zip file you sent me and it seems to be very similar to what i did (which didn't work).
in the example you sent me, they wrote the formula "=IF(User.isA,USE("A"),USE("B"))" in the fill pattern and i wrote the formula "=IF(Prop.halo=TRUE,USE("halo"),1)" in the LinePattern cell.
i really don't know what i'm doing wrong.

and vojo, i looked at the isometric shapes and didn't find any shape which is similar to what i'm trying to do.  can you give me the exact name of the shape?

thanks in advance
David

Visio Guy

Hi David,

If you can get a stripped-down, simplified version of your Visio drawing, you can attach it to a post, so maybe one of us can have a look at it.

You click "Additional Options..." on the lower-left of the post form to make attachments. I think they need to be less than 250 kb.

- Chris
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

david

great!! thanks.

i'm attaching a zip file with what i've done so far.
look at the triangle for example.  drag it to the frame and then at the custom proerties choose halo=true.  the line pattern should change to halo but it doesn't.

i put the formulas related to the halo in the last two lines of the scratch section.

hope anyone can help.
btw, if you have any suggestions for improving my formulas i'll be happy to hear anything.

thanks in advance
David

david

nobody knows how to make the halo line work from the shapesheet?

i tried also writing the following fomula in the LinePattern cell:
if(prop.halo=true,use("halo"),1)+dependson(prop.halo)

didn't work either.

please, anyone has any idea?

vojo

shapes on left set by custom properties....shapes on right by control points
(right click shape to see all features)

These are based off the june the second stencils

have fun

david

thanks
but i don't understand why you sent this to me.  this has nothing to do with my question.  i just wanted to know how to activate the LinePattern "halo" whenever the user chooses halo=true in the custom properties.

unless i missed something in the file you sent. if so please let me know.

thanks
David