CUSTOM RECTANGULAR REVISION CLOUD AROUND VIEW

CUSTOM RECTANGULAR REVISION CLOUD AROUND VIEW

josh.linares-stanley
Enthusiast Enthusiast
967 Views
3 Replies
Message 1 of 4

CUSTOM RECTANGULAR REVISION CLOUD AROUND VIEW

josh.linares-stanley
Enthusiast
Enthusiast

Hi,

Anyone aware of some iLogic that would allow me to create some custom revision clouds around selected part views (example below)? Just not a fan of the add-in cloud generator from the SDK. I'm currently having to create a sketch on individual views, draw a rectangle, constrain it evenly to the extents of view, format to layer style (blue dashed). 

 

If possible, Something that incorporated the view selector would be great. 

 

ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingViewFilter, "Select a View")

Many thanks in advance,

joshlinaresstanley_0-1642017928001.png

 

0 Likes
Accepted solutions (1)
968 Views
3 Replies
Replies (3)
Message 2 of 4

JelteDeJong
Mentor
Mentor
Accepted solution

I'm not completely sure what you want the end result to look like. (I guessed that the image shows the sketch not the end result.) But I think that this rule will do more or less what you want and I hope it's easy enough to change it.

Public Sub main
	
    Dim view As DrawingView = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingViewFilter, "Select a View")

    Dim sketch As DrawingSketch = view.Sketches.Add()
    Dim cp = sketch.SheetToSketchSpace(view.Position)
    Dim blue As Color = ThisApplication.TransientObjects.CreateColor(0, 0, 255)
	Dim offSetFromView As Double = 1
    sketch.Edit()

    Dim lines = CreateRectangle(sketch, cp, view.Width + offSetFromView, view.Height + offSetFromView)
    SetLayer(lines, LineTypeEnum.kDashedLineType, 0.05, blue)

    sketch.ExitEdit()
End Sub

Public Sub SetLayer(lines As SketchEntitiesEnumerator, LineType As LineTypeEnum, LineWeight As Double, color As Color)

    For Each line As SketchEntity In lines
        Line.Layer.LineType = LineTypeEnum.kDashedLineType
        Line.Layer.LineWeight = LineWeight
        Line.Layer.Color = color
    Next

End Sub

Public Function CreateRectangle(Sketch As DrawingSketch, cp As Point2d, w As Double, h As Double) As SketchEntitiesEnumerator
    Dim oTg = ThisApplication.TransientGeometry
    Dim p1 As Point2d = cp.Copy()
    p1.TranslateBy(oTg.CreateVector2d(w / 2, h / 2))

    Dim p3 = p1.Copy()
    p3.TranslateBy(oTg.CreateVector2d(-w, -h))

    Dim lines = Sketch.SketchLines.AddAsTwoPointRectangle(p1, p3)
    Return lines
End Function

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

0 Likes
Message 3 of 4

josh.linares-stanley
Enthusiast
Enthusiast

Hi,

 

Thanks a lot for the response and going to all that effort - much appreciated. For the most part, it's exactly what I'm looking for. 

The only thing I would say it that at reduced scales the rectangle scales at a different rate to the view. At 1:1 scale it works perfectly - as the part scales down, the rectangle seems to reduce by the factor of the scale. Possibly the width/height of the rectangle need to multiply by the scale? - Although I haven't quite managed to implement that yet

 

joshlinaresstanley_0-1642262198067.png

 

0 Likes
Message 4 of 4

josh.linares-stanley
Enthusiast
Enthusiast

Managed to fix  - added below for anyone else interested. Divides height & width by view scale. Many thanks

 

Public Sub main
	
    Dim view As DrawingView = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingViewFilter, "Select a View")

    Dim sketch As DrawingSketch = view.Sketches.Add()
    Dim cp = sketch.SheetToSketchSpace(view.Position)
    Dim blue As Color = ThisApplication.TransientObjects.CreateColor(0, 0, 255)
	Dim offSetFromView As Double = 1
    sketch.Edit()
	oScale = view.Scale
    Dim lines = CreateRectangle(sketch, cp, view.Width/oScale + offSetFromView, view.Height/oScale + offSetFromView)
    SetLayer(lines, LineTypeEnum.kDashedLineType, 0.05, blue)

    sketch.ExitEdit()
End Sub

Public Sub SetLayer(lines As SketchEntitiesEnumerator, LineType As LineTypeEnum, LineWeight As Double, color As Color)

    For Each line As SketchEntity In lines
        Line.Layer.LineType = LineTypeEnum.kDashedLineType
        Line.Layer.LineWeight = LineWeight
        Line.Layer.Color = color
    Next

End Sub

Public Function CreateRectangle(Sketch As DrawingSketch, cp As Point2d, w As Double, h As Double) As SketchEntitiesEnumerator
    Dim oTg = ThisApplication.TransientGeometry
    Dim p1 As Point2d = cp.Copy()
    p1.TranslateBy(oTg.CreateVector2d(w / 2, h / 2))

    Dim p3 = p1.Copy()
    p3.TranslateBy(oTg.CreateVector2d(-w, -h))

    Dim lines = Sketch.SketchLines.AddAsTwoPointRectangle(p1, p3)
    Return lines
End Function

 

0 Likes