I need to move the center of detail view fence to different point

I need to move the center of detail view fence to different point

Anonymous
Not applicable
1,069 Views
8 Replies
Message 1 of 9

I need to move the center of detail view fence to different point

Anonymous
Not applicable

Hi every one 

would any one help me to write  a code to move the center of detail view fence center  to different point please 

0 Likes
Accepted solutions (2)
1,070 Views
8 Replies
Replies (8)
Message 2 of 9

Ralf_Krieg
Advisor
Advisor

Hello

 

Don't know where to move to, so I take 0,0.

Dim oApp As Inventor.Application= ThisApplication    
Dim oDrawDoc As DrawingDocument = oApp.ActiveDocument
Dim oSheet As Sheet = oDrawDoc.ActiveSheet
Dim oDrawView As DetailDrawingView
Dim bDone As Boolean

Do While Not bDone = True
    oDrawView = oApp.CommandManager.Pick(kDrawingViewFilter, "Pick a detail view")
    If oDrawView Is Nothing Then
        Exit Sub
    End If
    If Not oDrawView.ViewType = kDetailDrawingViewType Then
        oDrawView = Nothing
    Else
        bDone = True
    End If
Loop

Dim oPoint As Point2d = oApp.TransientGeometry.CreatePoint2d(0, 0)

If oDrawView.AttachPoint Is Nothing Then
    oDrawView.FenceCenter = oPoint
Else
    MsgBox("Detail view is attached to geometry. Move not possible.", vbCritical)
End If

 


R. Krieg
RKW Solutions
www.rkw-solutions.com
Message 3 of 9

Anonymous
Not applicable

thank you but there must be away around like mouse pick and drag 

0 Likes
Message 4 of 9

Ralf_Krieg
Advisor
Advisor

Hello

 

If you want to pick the view fence and move it, there's no need to code. Just grab it and move it.

Can you explain in detail what you want to do?


R. Krieg
RKW Solutions
www.rkw-solutions.com
Message 5 of 9

Anonymous
Not applicable

here im looking to copy drawing into same different size item and the fence is always moving from the point that we chose to illustrate the details , here I need to move the fence back to it's location for mass production 

0 Likes
Message 6 of 9

Ralf_Krieg
Advisor
Advisor
Accepted solution

Hello

As I understand, you copy a sheet within a drawing and change the size of the sheet and/or the drawing views. Within this operations the fence is moved from the desired detail in the base drawing view.

You know, you can attach the fence to a geometry of the base drawing view? If attached, the fence stays in position when the drawingview is moved or scale factor is changed.

To attach a detail view right-click the detail view definition, then select Attach. Select the attachment vertex.
If I'm in the wrong direction, please correct me.


R. Krieg
RKW Solutions
www.rkw-solutions.com
Message 7 of 9

Anonymous
Not applicable

that is right I have to attach the fence first then write a code to change the radius of the fence in order to readjust it again, however there is no code to set the attachment , I have to do it manually  

0 Likes
Message 8 of 9

Ralf_Krieg
Advisor
Advisor
Accepted solution

Hello

 

You can set the attachpoint by code. Below is a sample code that will try to find a drawingcurve around the fencecenter of each detail drawing view on the active sheet and attach the detail drawingview to it. After this, it should be possible to copy the sheet, edit sheet size and drawing view scales and the fences stay in position.

 

Option Explicit on
Dim oApp As Inventor.Application= ThisApplication
Dim oDrawDoc As Inventor.DrawingDocument= oApp.ActiveDocument
Dim oSheet As Sheet= oDrawDoc.ActiveSheet
Dim oView As DrawingView
Dim oDetailView As DetailDrawingView
Dim dRadius As Double

For Each oView In oSheet.DrawingViews
	If oView.ViewType = DrawingViewTypeEnum.kDetailDrawingViewType Then
		oDetailView = TryCast(oView, DetailDrawingView)
		If oDetailView.AttachPoint Is Nothing Then
			If oDetailView.CircularFence = True Then
				dRadius=oDetailView.FenceRadius 
			Else
				dRadius = oDetailView.FenceCenter.DistanceTo(oDetailView.FenceCornerOne)
			End If
			Dim oObjEnum As ObjectsEnumerator = oSheet.FindUsingPoint(oDetailView.FenceCenter, dRadius)
			Dim oDrawCurveSegment As DrawingCurveSegment
			Dim oObj As Object
			For Each oObj In oObjEnum
			    If TypeOf oObj Is DrawingCurveSegment Then
			        oDrawCurveSegment = oObj
			        Exit For
			    End If
			Next
			If Not oDrawCurveSegment Is Nothing Then
			    Dim oGeomIntent As GeometryIntent= oSheet.CreateGeometryIntent(oDrawCurveSegment.Parent, oDrawCurveSegment.Parent.EndPoint)
				oDetailView.AttachPoint = oGeomIntent
			Else
			    MsgBox ("Could not find an entity to attach Detailview " & oDetailView.Name)
			End If
		End If
	End If
Next

MsgBox("Done",MsgBoxStyle.Information,"iLogic")

 


R. Krieg
RKW Solutions
www.rkw-solutions.com
Message 9 of 9

Anonymous
Not applicable

that is so nice of you 

thank you so much 

0 Likes