bss2311
Automotive
- Dec 23, 2016
- 1
Hi,
I have made one block in part and then created view of that part in drawing.
Now I am trying to get co-ordinates value with respect to that particular view when user will select screen position in that view.
I am able to get point co-ordinates with respect to drawing.
By using below code i am able to get origin of activated view.
Module Module1
Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
Dim theUI As UI = UI.GetUI
Sub Main()
Dim X, Xx, Y, Z As Double
If IsNothing(theSession.Parts.Work) Then
'active part required
Return
End If
Dim dwgsheet As Drawings.DrawingSheet
dwgsheet = workPart.DrawingSheets.CurrentDrawingSheet
'Seclect screen position
'Dim myPoint_1 As Point3d
'Dim response1 As Selection.DialogResponse = UserSelectScreenPos("Select First corner .......", myPoint_1)
'If response1 <> Selection.DialogResponse.Pick Then
' Return
'End If
For Each View As Drawings.DraftingView In dwgsheet.SheetDraftingViews
If View.IsActiveForSketching = True Then
X = View.AbsoluteOrigin.X
Y = View.AbsoluteOrigin.Y
Z = View.AbsoluteOrigin.Z
' MsgBox(CStr(X))
MsgBox(CStr(Xx))
End If
Next
End Sub
End Module
I have made one block in part and then created view of that part in drawing.
Now I am trying to get co-ordinates value with respect to that particular view when user will select screen position in that view.
I am able to get point co-ordinates with respect to drawing.
By using below code i am able to get origin of activated view.
Module Module1
Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
Dim theUI As UI = UI.GetUI
Sub Main()
Dim X, Xx, Y, Z As Double
If IsNothing(theSession.Parts.Work) Then
'active part required
Return
End If
Dim dwgsheet As Drawings.DrawingSheet
dwgsheet = workPart.DrawingSheets.CurrentDrawingSheet
'Seclect screen position
'Dim myPoint_1 As Point3d
'Dim response1 As Selection.DialogResponse = UserSelectScreenPos("Select First corner .......", myPoint_1)
'If response1 <> Selection.DialogResponse.Pick Then
' Return
'End If
For Each View As Drawings.DraftingView In dwgsheet.SheetDraftingViews
If View.IsActiveForSketching = True Then
X = View.AbsoluteOrigin.X
Y = View.AbsoluteOrigin.Y
Z = View.AbsoluteOrigin.Z
' MsgBox(CStr(X))
MsgBox(CStr(Xx))
End If
Next
End Sub
End Module