Need quick advice on dropping a master on top of a selected groupshape.

G

GigaMuxer

All,

I been looking for a solution on this for quite some time. It seems
that either I am not asking the right questions or it can't be done.

I would like to drop a master on a page.
This master shape is a modular chassis. Kind of like the chassis of a
big networking router or a switch where you can ad or remove slots/modules.

When the user dropps the chassis master on the page a form comes up
asking how you want to fill up the chassis shape.

The slot or modules are also part of the same stencill. and I am using
comboboxes to select the module master names for each chasis slot.

I am having problems lining up the module masters on the chassis slots
properly.


Lets say the Chassis master nameID is: Chassis.1
In the chasis master the slots are: slot.1, slot.2 and slot.3

The module masters are rectangular shapes and the modules slots in the
Master Chassis are also rectagular and they are both the same size.

How can I reference the slot rectangle's pinX and pinY coordinates in
the chasis master so I can ?

After I place all the slot cards into the chasis I want to make them
part of a group. Suggestion?

Examples?

Regards,
LRR
 
C

Chris Roth [ Visio MVP ]

ShapeSheet-wise, you need to set a formula that looks like this:

For the module:

PinX = slot1!PinX
PinY = slot1!PinY

assuming that both have their pins (rotation points) located in the center
of the shape.

If the slots are buried in a group, then the naming won't work. You'll have
to get the ID of the slot shapes. Do this with Format > Special and note the
ID. Then the formulas will look like this:

PinX = Sheet.1!PinX
PinY = Sheet.2!PinY

where 1 and 2 should be the real IDs of the slot shapes.

If you're doing this by code, then you set a formula like this:

ShapeModule.Cells("PinX").Formula = "Sheet.1!PinX", etc.



--

Hope this helps,

Chris Roth
Visio MVP
 
A

Al Edlund

I use this logic to install router/switches into cabinets (they are dropped
on the page by a different function). This assumes that the receiving
component (in this case the rack) has appropriately named connection points
in the master shape.
Al

Private Sub MoveComponentToCabinet(ByVal strCabName As String, _

ByVal strComponent As String, _

ByVal strLeftShelf As String, _

ByVal strRightShelf As String)

Dim vsoShape As visio.Shape

Dim vsoWindow As visio.Window

Dim vsoDocument As visio.Document

Dim vsoApplication As visio.Application

Dim vsoPage As visio.Page

vsoWindow = AxDrawingControl1.Window

vsoApplication = vsoWindow.Application

vsoDocument = vsoApplication.ActiveDocument

vsoPage = vsoApplication.ActivePage

Dim viscell As visio.Cell

Dim strBeginX As String

Dim strEndX As String

Dim strBeginY As String

Dim strEndY As String

Dim strStep As String = ""





Try



If strComponent = "" Then Exit Sub



' build the cell formulas for connecting component to correct cabinet

' and shelf

strBeginX = "=PAR(PNT('" & strCabName & "'!Connections." & strLeftShelf &
".X,'" & strCabName & "'!Connections." & strLeftShelf & ".Y))"

strEndX = "PAR(PNT('" & strCabName & "'!Connections." & strRightShelf &
".X,'" & strCabName & "'!Connections." & strRightShelf & ".Y))"

strBeginY = "PAR(PNT('" & strCabName & "'!Connections." & strLeftShelf &
".X,'" & strCabName & "'!Connections." & strLeftShelf & ".Y))"

strEndY = "PAR(PNT('" & strCabName & "'!Connections." & strRightShelf &
".X,'" & strCabName & "'!Connections." & strRightShelf & ".Y))"



For Each vsoShape In vsoPage.Shapes

If vsoShape.NameU = strComponent Then

' if this is the correct one then tell it where to go

If vsoShape.CellExists("beginx", False) Then

viscell = vsoShape.Cells("BeginX")

viscell.Formula = strBeginX

'SetCellValueToString(viscell, strBeginX)

End If

If vsoShape.CellExists("endx", False) Then

viscell = vsoShape.Cells("EndX")

viscell.Formula = strEndX

'SetCellValueToString(viscell, strEndX)

End If

If vsoShape.CellExists("beginy", False) Then

viscell = vsoShape.Cells("BeginY")

viscell.Formula = strBeginY

'SetCellValueToString(viscell, strBeginY)

End If

If vsoShape.CellExists("endy", False) Then

viscell = vsoShape.Cells("EndY")

viscell.Formula = strEndY

'SetCellValueToString(viscell, strEndY)

End If

strStep = "done with connections"

' put these back where they belong

viscell = vsoShape.Cells("PinX")

SetCellValueToString(viscell, "(BeginX+EndX)/2")

viscell = vsoShape.Cells("PinY")

SetCellValueToString(viscell, "(BeginY+EndY)/2")

Exit Sub

End If

Next

Catch err As Exception

MsgBox("move component to cabinet " & strstep & " " & err.Message)

subLogException(err)

subDisplayException(Nothing, err)

End Try



End Sub
 
V

vojo

check out setatrefexpr function in pinx/piny module shape. I used the
following:

int(setatrefexpr()-setatrefexpr())+slot_number*slot_width

pinx/piny of chassis in my case is lower left.
measurements are in mm.

Note in my similar app, I actually play with select mode and group
properties so that double click to edit...edit...double click to enable
move
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top