几何尺寸与公差论坛

 找回密码
 注册
查看: 936|回复: 0

【转帖】how to get sheetcoordinate of point selected in drawing view

[复制链接]
发表于 2009-4-12 21:19:08 | 显示全部楼层 |阅读模式
how to get sheetcoordinate of point selected in drawing view
hi
i would like to get sheet coordiates of the point of sketch selected 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 as double,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 coordinate for particular view.
can anyone have macro for this thing.
quick
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|几何尺寸与公差论坛

GMT+8, 2024-12-23 13:58 , Processed in 0.037070 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表