News:

BB code in posts seems to be working again!
I haven't turned on every single tag, so please let me know if there are any that are used/needed but not activated.

Main Menu

Change Color of line from with info in random shape.

Started by Speedkiller1975, October 28, 2016, 05:44:01 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Speedkiller1975

Hallo All.

I'm working on Logic symbols see piture as attachment.

I can change from the shape the input from 1 to 0.

i like to have the line connected to it to change color. i can do this with  a formule IF(Multi Logic.57!Prop.Input_1=1,2,0)

This is working correct.

my problem is
"Multi Logic" is a variable this can be "NOT", "Multi Logic", ect
".57" is a variable number this is given by Visio and can be any number i think
"Prop.Input_1" is a variable this can be "Prop.Input_1", "Prop.Input_2", ect

In the line I have made shape data

Prop.Input = can be Prop.Input_1 or Prop.Input_2 ect. (1 (Type list fix))
Prop.Type_symbol = can be Multi Logic or NOT ect. (1 (Type list fix))
Prop.Number_symbol = " a number the user gives" (2 (Type Number))

if i than use
If(Prop.Input&Prop.Number_symbol&"!"&Prop.Input=1,2,0)

I get the value 0 always.

if I change the 1 to Multi Logic.57!Prop.Input_1 i get a 2.

is there a way to use the variable value in a formule.

i wish it can be done in the shapedata sheet.


If it is in VBA it is also good.
Only I'm not know how to get the data from "Prop.Input, Prop.Type_symbol,Prop.Number_symbol" to VBA and then put it back in the cell Line Format -> LineColor.

i know a bit about Excel VBA and if i do this it works in excel
If i use EXcel vba than this works.

Cell1 = "C4"
Cell2 = "C5"
Formule = "="
Formule = Formule + Cell1
Formule = Formule + "+"
Formule = Formule + Cell2

Range("C6").Formula = Formule

a picture of how it looks

wapperdude

Hi Speedkiller1975,

So this topic is just a spin of a previous topic...not really new.

As previously by Vojo, cannot do this in shapesheet...need VBA to find the shape.

As indicated by Metuemre, he probably has solution that meets your needs which he'll provide after vacation.  Patience.

The basic VBA steps would go something like this:
  1) select connector
  2) find shape connected to, and capture shape name
  3) get cell info from shape using results method
  4) based upon cell info, change connector line color using formula method.

Wapperdude

Visio 2019 Pro

JuneTheSecond

I've received a mail from Yacine to make me aware of  this topics.
I'd made some shapes and connector before for Logical or decimal calculations,
but now I've forgot the details, because I am too old.
http://june2.carrots.jp/english/colorledthemecolor.htm
It is my joy, if any of them is helpful, though I am not sure they are.
Best Regards,

Junichi Yoda
http://june.minibird.jp/

metuemre

As promised, please find attached a sample of Logic Drawing Template file with Function Blocks stencil.

metuemre

Another way to identify glued shapes and connection points is to use Shape.GluedShapes method and Shape.Connects property. Below is a related topic;

http://visguy.com/vgforum/index.php?topic=3443.0


metuemre

Sample code with Shape.GluedShapes method. Main idea is to synchronize Connection names and Shape Data names,e.g., if a connector is glued to Connections.OUT then it will read the value from Prop.OUT

Private Sub DIConnectionFind(shp As Visio.Shape)

Dim shpIDs() As Long
Dim FromShp As Visio.Shape
Dim ToShp As Visio.Shape
On Error Resume Next
   
shpIDs() = shp.GluedShapes(visGluedShapesIncoming2D, "")
Set FromShp = ActivePage.Shapes.ItemFromID(shpIDs(0))
shpIDs() = shp.GluedShapes(visGluedShapesOutgoing2D, "")
Set ToShp = ActivePage.Shapes.ItemFromID(shpIDs(0))

shp.Cells("User.FromShape").formula = Chr(34) & FromShp.name & Chr(34)
shp.Cells("User.ToShape").formula = Chr(34) & ToShp.name & Chr(34)

shp.Cells("User.FromInput.Prompt").FormulaU = "=SETF(GetRef(Prop.Value),User.FromShape&" & Chr(34) & "!" & "Prop." & shp.Connects(1).ToCell.RowName & Chr(34) & ")"
shp.Cells("User.ToInput.Prompt").FormulaU = "SETF(" & Chr(34) & ToShp.name & "!" & "Prop." & shp.Connects(2).ToCell.RowName & Chr(34) & ",Prop.Value)"

End sub

Browser ID: smf (possibly_robot)
Templates: 4: index (default), Display (default), GenericControls (default), GenericControls (default).
Sub templates: 6: init, html_above, body_above, main, body_below, html_below.
Language files: 4: index+Modifications.english (default), Post.english (default), Editor.english (default), Drafts.english (default).
Style sheets: 4: index.css, attachments.css, jquery.sceditor.css, responsive.css.
Hooks called: 269 (show)
Files included: 34 - 1306KB. (show)
Memory used: 1117KB.
Tokens: post-login.
Cache hits: 13: 0.00154s for 26,766 bytes (show)
Cache misses: 2: (show)
Queries used: 16.

[Show Queries]