Visio Discussions > ShapeSheet & Smart Shapes
Custom Fill Pattern changing with Shape's Data fields
(1/1)
jamason1182:
So far I can't find anyone else asking this question so here goes.
I have a custom fill pattern that represents the top-down view of ceiling grid. So I draw the room (walls, windows, etc) and then I put a rectangle in the middle of the room and add points until that rectangle follows the walls. I then select the custom fill pattern for the type of ceiling it will be - 2'x2' at 0degrees, or 2'x4' at 45 degrees, etc. The fill pattern is scaled so then I can plan the placement of lights, sprinklers, smoke detectors, speakers, etc.
Since Architect's hate builders and design things that are never at proper angles, I need to be able to specify the offset distance where the ceiling grid pattern will start as well as the angle the ceiling grid will run at. But I can't get the fill pattern shapesheet to see the "containing" shape's shape data.
For instance, if I have an odd shaped room and I get my rectangle as the shape, I define shape data fields called VerticalOffset and HorizontalOffset and CeilingAngle. But no matter what I do, the Prop.VerticalOffset (etc) are not visible to the fill pattern's shapesheet so can have the lines drawn adjust based on changing those data fields.
Is there a way using the shapesheet to do this? I'm open to using VBA, but then we are talking about events or CallThis type functions and I'm lost.
jamason1182:
To be clear, my goal is to make one custom Fill pattern, and have the shapesheet of the fill pattern change based on the shape data from the shape that is using the fill pattern.
I've attached a quick idea of what I'm talking about (though I'm not sure the custom fill pattern will go through... literally it's just a 2'x4' rectangle that repeats). What I want to do is change the shape data for this funky shape (no group or anything, simple shape) and have the fill pattern use those Prop values to change the repeating lines on the fill pattern so that it offsets or changes angle. I know I'll have some math to do for the angles etc., but I need access to the Prop values first!
Thanks
Yacine:
Hi Jamason,
please find enclosed a form that moves the pattern by dx and dy, respectively rotates it by angle d_alpha.
Interestingly I'm overseeing something, the move is applied only the first time.
May be you can help debugging it.
--- Code ---
Option Explicit
Private Sub cmMove_Click()
Dim shp As Shape
Dim mst As Master
Dim win As Window
Dim patternName As String
Dim formula As String
Dim temp As Variant
Dim grp As Shape
If ActiveWindow.Selection.Count = 1 Then
Set shp = ActiveWindow.Selection(1)
Else
MsgBox "Please select one shape"
Exit Sub
End If
formula = shp.Cells("FillPattern").FormulaU
temp = Split(formula, Chr(34))
If UBound(temp) = 2 And temp(0) = "USE(" Then
patternName = temp(1)
Else
MsgBox "The formula in the FillPattern field has not the right form"
Exit Sub
End If
Set mst = ActiveDocument.Masters.Item(patternName)
Set win = mst.Open.OpenDrawWindow
win.Activate
win.SelectAll
Set grp = win.Selection.Group
If tdx.Value <> "" Then
grp.Cells("PinX").formula = grp.Cells("PinX").ResultIU & " +" & tdx
End If
If tdy.Value <> "" Then
grp.Cells("PinY").formula = grp.Cells("PinX").ResultIU & " +" & tdy
End If
If talpha.Value <> "" Then
grp.Cells("angle").formula = talpha.Value
End If
grp.Ungroup
Application.ActiveWindow.Master.Close
End Sub
--- End code ---
Navigation
[0] Message Index
Go to full version