Preview   |   SOLIDWORKS User Forum

 How to get SheetCoOrdinate of point selected in drawing view
Solidworks Forum   |  13 年 前
Open in Forum   

必要なのは、SOLIDWORKS ID または新規/既存の 3DEXPERIENCE ID のみです。

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

このページを表示するための権限がありません 結果が見つかりません。 ヒント: スペルをチェックし、別の検索を行うか、以下のトピックを参照してください。