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

У вас нет прав на просмотр этой страницы Результаты не найдены! Советы: проверьте орфографию, введите другой поисковый запрос или просмотрите темы из списка ниже.