Position Section Line Sketch in Parent View Using iLogic

Position Section Line Sketch in Parent View Using iLogic

insomnix
Advocate Advocate
1,142 Views
2 Replies
Message 1 of 3

Position Section Line Sketch in Parent View Using iLogic

insomnix
Advocate
Advocate

I am trying to create some automation, but I also want to make it easy for others without much iLogic experience to edit, maintain, and duplicate. There are other threads on how to create a new section view through iLogic, but I want to be able to create the section view manually and place notes, dimensions, symbols, etc.

 

What I would normally do is right click on the section line and edit; then dimension the line to the part so it would stretch and move with the changes to the part. With the parts I am working on now this method does not work. The part is just a rectangle, but the outside edges have a profile that changes based on the part. When the profile changes, all association with the sketch line edit dimensions are lost. 

 

Below is an example of my normal routine for setting section lines that will dynamically change with the part for section views. 

image.png

For reasons I don't want to get into, the position of the section view is not centered on purpose. So I have an equation that off centers it. 

image.png

This gives me a nice predictable section view, until this roundover profile changes to a chamfer. Then these dimensions are all lost. 

image.png

0 Likes
Accepted solutions (1)
1,143 Views
2 Replies
Replies (2)
Message 2 of 3

insomnix
Advocate
Advocate

I'm starting to think the only solution to this one is to create the detail view from scratch via iLogic every time. Was hoping for something a little less tedious that would be easy to train people who are not strong in iLogic.

0 Likes
Message 3 of 3

insomnix
Advocate
Advocate
Accepted solution

Finally found the solution to the problem. Have to find the view the sketch is on first, then iterate through all sketches on the view to find the ones to update by name. Delete the line and re-add the line for the section view.

 

	Dim oDoc As DrawingDocument = ThisApplication.ActiveDocument
	Dim oSheet As Sheet = oDoc.ActiveSheet
	' Get the view the section views are being created from
	Dim oView As DrawingView = ActiveSheet.View("FRONT VIEW").View 
	' Set a reference to the transient geometry object.
	Dim oTG As TransientGeometry = ThisApplication.TransientGeometry
	Dim oSketch As DrawingSketch
	Dim line As SketchLine
	Dim vertLinePoint As Double = oView.Height / oView.Scale / 2 + 2
	Dim horzLinePoint As Double = oView.Width / oView.Scale / 2 + 2

	For Each oSketch In oView.Sketches
		Select Case oSketch.Name 
			Case "vert"
				' Open the sketch for edit.
				oSketch.Edit
				' delete all lines in sketch
				For Each line In oSketch.SketchLines
					line.Delete
				Next
				' redraw line in the sketch to move section view
				Call oSketch.SketchLines.AddByTwoPoints(oTG.CreatePoint2d(0, vertLinePoint), oTG.CreatePoint2d(0, -vertLinePoint))
				' Exit from editing the sketch.
				oSketch.ExitEdit
			Case "horz" 
				' Open the sketch for edit.
				oSketch.Edit
				' delete all lines in sketch
				For Each line In oSketch.SketchLines
					line.Delete
				Next
				' redraw line in the sketch to move section view
				Call oSketch.SketchLines.AddByTwoPoints(oTG.CreatePoint2d(horzLinePoint, 0), oTG.CreatePoint2d(-horzLinePoint, 0))
				' Exit from editing the sketch.
				oSketch.ExitEdit
		End Select
	Next
0 Likes