Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple broken views

Status
Not open for further replies.

romaleee

Mechanical
May 13, 2016
37
HR
Hi,

can anyone help me with automating "Multiple broken views" in same direction. I would like to get this with vba::

image_pfegwf.png


The code seems to break when it gets to creating second BrokenView

Code:
Sub CATMain()

Dim drawingDocument1 As DrawingDocument
Set drawingDocument1 = CATIA.ActiveDocument

Dim drawingSheets1 As DrawingSheets
Set drawingSheets1 = drawingDocument1.Sheets

Dim drawingSheet1 As DrawingSheet
Set drawingSheet1 = drawingSheets1.ActiveSheet

Dim drawingViews1 As DrawingViews
Set drawingViews1 = drawingSheet1.Views

Dim drawingView1 As DrawingView
Set drawingView1 = drawingViews1.ActiveView

Dim factory2D1 As Factory2D
Set factory2D1 = drawingView1.Factory2D

Dim drawingViewGenerativeBehavior1 As DrawingViewGenerativeBehavior
Set drawingViewGenerativeBehavior1 = drawingView1.GenerativeBehavior
drawingViewGenerativeBehavior1.UnBreak
Dim arrayOfVariantOfDouble1(7)
arrayOfVariantOfDouble1(0) = 403.5
arrayOfVariantOfDouble1(1) = 150.324075
arrayOfVariantOfDouble1(2) = 411.5
arrayOfVariantOfDouble1(3) = 150.324075
arrayOfVariantOfDouble1(4) = 403.5
arrayOfVariantOfDouble1(5) = 760.534615
arrayOfVariantOfDouble1(6) = 411.5
arrayOfVariantOfDouble1(7) = 760.534615

Set drawingViewGenerativeBehavior1Variant = drawingViewGenerativeBehavior1
drawingViewGenerativeBehavior1Variant.DefineBrokenView arrayOfVariantOfDouble1, 0#, 1#

arrayOfVariantOfDouble1(1) = 0.324075
arrayOfVariantOfDouble1(3) = 0.324075
arrayOfVariantOfDouble1(5) = 100.534615
arrayOfVariantOfDouble1(7) = 100.534615

Set drawingViewGenerativeBehavior1Variant = drawingViewGenerativeBehavior1
drawingViewGenerativeBehavior1Variant.DefineBrokenView arrayOfVariantOfDouble1, 0#, 1#

End Sub

Thanks in advance
 
Replies continue below

Recommended for you

I played around with this and couldn't make it work in the short time I had.

Some trouble shooting I tried with no luck:
[ul]
[li]DefineBrokenView needs to be late bound[/li]
[li]Tried creating a 2nd full array to verify input data was correct[/li]
[li]Both lines creating the breakview worked fine independently but not sequentially[/li]
[li]Checked with my own geometry if the boundary lines for the break cross the view geometry fully (or if that matters) I was thinking maybe the height of the lines somehow shifted after the first break occured[/li]
[li]Tried updating the view in between the break commands[/li]
[/ul]
 
Glad to see that I'm at least thinking in the similar direction as someone else. One thing that I tried in addition to your pointers is to OpenEdition of the drawingview.factory2D.parent (sketch) and create two lines on desired spot. I realize that drawingview.factory2D.parent.OpenEdition equals drawingview.factory2D and I was turning in circle but hey ... desperate times, desperate measures. Saw it in macro recording that some kind of OpenEdition is recorded between two broken views and why not try. Conclusion - didn't work :). Maybe someone, someday comes with an answer to this thread.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top