Quantcast
Channel: MicroStation Programming Forum - Recent Threads
Viewing all articles
Browse latest Browse all 7260

[CONNECT VBA] Clip inside fence

$
0
0

Hi!

I have a DGN file with many elements (lines, linestrings, shapes, sharedcells, etc.).

I make a fence from an shape element. I have these elements in the array in the program and they are drawn in the model.

If I use a tool for fence, then everything works fine.

Then I wrote a small macro to do this automatically. But the result of his work is different.

    For i = LBound(Segments) To UBound(Segments)
        Dim oFence As Fence
        Dim oFenceContents As ElementEnumerator

        ActiveSettings.FenceVoid = False
        ActiveSettings.FenceOverlap = False
        ActiveSettings.FenceClip = True

        Set oFence = ActiveModelReference.Attachments(Index).DesignFile.Fence   ' This attached file has elements for clip
        oFence.DefineFromModelPoints TopView, Segments(i).Points                ' This shape's vertices

        Set oFenceContents = oFence.GetContents

        While oFenceContents.MoveNext
            Dim curEle As Element
            Set curEle = oFenceContents.Current.Clone   ' if without clone - error "Invalid cell"
            curEle.Color = 3
            curEle.LineWeight = 1

            ActiveModelReference.AddElement curEle
            Set curEle.Level = ActiveModelReference.Levels.FindByNumber(0)
        Wend
    Next i

What could be the problem?


Viewing all articles
Browse latest Browse all 7260

Trending Articles