How can I check if a shape overlaps a hidden geometry section?

From: Jerry Palmer (anonymous_at_discussions.microsoft.com)
Date: 03/16/04

  • Next message: mehrab: "Is there a way to reverse engineer typelibs/IDL into visio UML diagrams?"
    Date: Tue, 16 Mar 2004 03:13:36 -0800
    
    

    I am developing a simple enhancement to Visio to help me
    draw longitudinally scaled drawings (i.e. scaled in one
    dimension only, and with changes of scale at various
    points). I want to use a shape (called a "Line of Way")
    with a rectangular geometry section to define the scale
    and starting distance of each section of the drawing.
    When I drop shapes onto the page, I want some VBA code to
    figure out what Line of Way the shape belongs to and hence
    determine its longitudinal distance from the start of the
    plan. I want to keep the geometry section of the Line of
    Way hidden so as not to clutter the drawing.

    I have written the ShapeAdded method below. If I add a
    new shape (shpNew) to the document and it lies within a
    Line of Way (shpX) rectangle, the code gives the new shape
    a formula to work out its distance from the reference
    point (datum). I use properties with specific names to
    help the program work out whether the shape needs a
    distance (Prop.Km) and whether a containing shape is a
    Line of Way (Prop.Km0 and Prop.Scale).

    Private Sub Document_ShapeAdded(ByVal shpNew As IVShape)
        Dim shpX As Shape
        Dim sLoW As String
        If shpNew.CellExists("Prop.Km", 0) Then
            For Each shpX In shpNew.SpatialNeighbors _
                    visSpatialContainedIn, _
                    0, _
                    visSpatialIncludeHidden)
                If shpX.CellExists("Prop.Km0", 0) Then
                    sLoW = shpX.Name
                    shpNew.Cells("Prop.Km").Formula = sLoW & _
                        "!Prop.Km0 + " & _
                        sLoW & "!Prop.Scale*(PinX-" & sLoW & _
                        "!PinX)"
                End If
            Next shpX
        End If
    End Sub

    Note how I use the visSpatialIncludeHidden flag, which the
    documentation says should take hidden geometry sections
    into account. However, the code works if my Line of Way
    geometry section is filled (Geometry1.NoFill = FALSE) and
    visible (Geometry1.NoShow = FALSE), but not otherwise.

    Am I missing something? Is this a bug? If so, is there a
    fix? I suppose I could work around it with layers, but
    I'd rather avoid them because I use layers for something
    else already.


  • Next message: mehrab: "Is there a way to reverse engineer typelibs/IDL into visio UML diagrams?"

    Relevant Pages

    • Re: Macro required
      ... Actual size is a variable determined by the current scale of the 2D layout ... at the time the DXF is generated. ... If I have a drawing of a 1" square block, ... size of the geometry represented in the DXF will be 1/2" square. ...
      (comp.cad.solidworks)
    • Re: RE-SIZING DRAWING VIEWS
      ... How does one go about sizing the "virtual" drawing views. ... In the Property Manager, under Scale, ... You may have data in the part file located some distance from the part ... View extents of the 5-foot part will include the chunk that you ...
      (comp.cad.solidworks)
    • Re: Q: How does scaling a drawing work
      ... lets say that you have a .dgn drawing and you measure the distance ... 1.If you are plotting 1:100 scale then, ...
      (comp.cad.microstation)
    • Re: Printing w/ Visio 2000
      ... printer page size of 8.5" x 11", a standard architectural scale, a page ... The advantage to using a standard architectural scale is ... set the size of the drawing page to match the printed ... If I set Zoom to fit 1:1, ...
      (microsoft.public.visio.general)
    • Re: engineering drawing question
      ... Art majors, however, may scale. ... > a drawing isn't to scale, why in hell AIN'T it to scale? ... > If I'm looking at a drawing of a jig plate with 300+ holes of all ... pattern to one reference hole, and referencing that reference hole to the ...
      (sci.engr.mech)