Preview   |   SOLIDWORKS User Forum

 How to get SheetCoOrdinate of point selected in drawing view
Solidworks Forum   |  13 years ago
Open in Forum   

All you need is a SOLIDWORKS ID, or a new or existing 3DEXPERIENCE ID.

Hi
I would like to get sheet coordiates of the point of sketchselected in drawing view.
I am using following code to implement my logic

Set swApp = New SldWorks.SldWorks
Set swModel = swApp.ActiveDoc
Set swSelMgr = swModel.SelectionManager
Set swSketchPoint = swSelMgr.GetSelectedObject6(1,0)
Set swSketch = swSketchPoint.GetSketch
XVal = swSketchPoint.X
YVal = swSketchPoint.Y
ZVal = swSketchPoint.Z
view_name = "Drawing View1"
------------------------------------------
Public Sub GetTransform(XVal As Double, YVal As Double, ZVal AsDouble,view_name as String)
Dim dblPt(2) As Double
Dim vLoc As Variant
Dim oLoc As Object
Dim oLocXformed As Object
' Dim vLocXformed As Variant
Dim vViewxform As Variant
Dim oViewXform As Object
dblPt(0) = XVal
dblPt(1) = YVal
dblPt(2) = ZVal
Set swModel = swApp.ActiveDoc
Set swMathUtil = swApp.GetMathUtility
Set swSelMgr = swModel.SelectionManager
Set swDraw = swModel
swModel.ClearSelection2 (True)
boolstatus = swModel.Extension.SelectByID2(view_name,"DRAWINGVIEW", 0, 0, 0, True, 0, Nothing, 0)
If (boolstatus = 1) Then
Set swView = swSelMgr.GetSelectedObject6(1, 0)
Set swSelMgr = swDraw.SelectionManager
vViewxform = swView.GetViewXform
ReDim Preserve vViewxform(15)
Set oViewXform = swMathUtil.CreateTransform((vViewxform))
vLoc = dblPt
Set oLoc = swMathUtil.CreatePoint((vLoc))
Set oLocXformed = oLoc.MultiplyTransform(oViewXform)
vLocXformed = oLocXformed.ArrayData
End If
End Sub
-----------------------------------------
But from this i am not able to get the Perfect x and y coordinatefor particular view.
can anyone have macro for this thing.SolidworksApi macros



You are not authorized to view this page No results found! Suggestions: Check spelling, try a different search, or browse topics below.