|
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 |
|