Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Anonymous
1520 Views, 2 Replies

iLogic Rule to Create Sketch on .idw Views, Project Geometry, then Apply Hatch

Hello,

 

I am working on a drawing (.idw) for an assembly. The drawing contains multiple sheets. Each sheet contains multiple views, which are generated from view representations of the assembly. Each view shows off a unique part that is used in the assembly. The parts are simple, continuous solids with several flat surfaces (no holes, no interior geometry, etc.). All the parts are similar, but not identical. I would like to implement an iLogic rule that can achieve the following.

 

For each view on the sheet...

1. Create a new sketch (sketch needs to be associated with the view)

2. Project all the edges of the part

3. Create a closed profile from the collection of projected edges

4. Apply a hatch pattern to the closed profile

 

I have written a rule that, so far, achieves steps 1 and 2 but not steps 3 and 4. Here is my code:

 

'Definitions
Dim oApp As Application
Dim oDD As DrawingDocument
Dim oSht As Sheet
Dim oDV As DrawingView
Dim oDS As DrawingSketch
Dim oDC As DrawingCurve
Dim oDCS As DrawingCurveSegment

oApp = ThisApplication
oDD = oApp.ActiveDocument
oSht = oDD.ActiveSheet

'Loop through all views that currently exist on the active sheet
For Each oDV In oSht.DrawingViews
	
	'Create a new sketch on the active view
	oDS = oDV.Sketches.Add
	
	'Project all edges of the part shown in the view
        For Each oDC In oDV.DrawingCurves
      	    oDS.AddByProjectingEntity(oDC)
        Next
	
	'Create a closed profile from the collection of projected edges
	'Apply a hatch pattern to the closed profile
	
Next

 I have included 2 screen shots with my post:

"OriginalViewsOnSheet.jpg"  - Shows the sheet before running the rule

"HatchedViewsOnSheet.jpg" - Shows the sheet after running the rule (what I want the rule to do)

 

Any help would be much appreciated.

 

Thanks,

jpepper