Showing results for 
Search instead for 
Do you mean 
Reply

How to get the cursor position after select object.

[ Edited ]

Hi,

 

I'm using NX 7.5, TeamCenter 8, Win7 Pro. X64, C#(.NET Framework 3.5)

 

I tried to run a sample source from GTAC but a error as below was appeared.

 

----Error Message----
NXOpen.NXException: Invalid property name for the block. See syslog for details
NXOpen.BlockStyler.PropertyList.GetPoint(String propertyName)
idsymbol.apply_cb() file c:\Tempugs\NXJournals94304\journal.vb: line 332

 

 

The error was from below code.

Dim cursor As Point3d = selection0.GetProperties.GetPoint("PickPoint")

 

I tried to print selection0's propertynames but "PickPoint" property was not found.

 

"PickPoint" Property is not available NX7.5?

 

if not available, how to get the same function?

 

Source link:

http://community.plm.automation.siemens.com/t5/forums/postpage/board-id/Source%20link:%20https:/solu...

 

 

 

----Source Code----

'------------------------------------------------------------------------------
'Callback Name: apply_cb
'------------------------------------------------------------------------------
Public Function apply_cb() As Integer
Dim errorCode As Integer = 0
Try

'---- Enter your callback code here -----
Dim objects As TaggedObject() = selection0.GetProperties.GetTaggedObjectVector("SelectedObjects")
Dim cursor As Point3d = selection0.GetProperties.GetPoint("PickPoint") <- line: 332
Dim screen_pos As Point3d = cursorLocation0.GetProperties.GetPoint("CursorLocation")
Dim view1 As DraftingView = Nothing
Dim obj_coords As Point3d = Nothing

view1 = CType(workPart.DraftingViews.FindObject(vwname), Drawings.DraftingView)
obj_coords = get_position_on_object(objects(0), view1, cursor)

create_idsymbol(objects(0), obj_coords, screen_pos, view1, nr)
nr = nr + 1

Catch ex As Exception

'---- Enter your exception handling code here -----
errorCode = 1
theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString)
End Try
apply_cb = errorCode
End Function

 

----Source Code----



 

2 REPLIES

Re: How to get the cursor position after select object.

I answered your Eng-Tips question on this in this thread (I presume it was you as the user names are the same).

So PickPoint was added in NX8.5. I'm not aware of any other way to get the same functionality.

Graham Inchley Snr R&D Engineer (Systems Development), Sandvik Coromant
Lenovo ThinkPad W540, Win7, 16GB. Developing in: Java | C | C# | KF
Production: NX8.5.3.3 MP11 64bit Testing: NX9.0.2.5

Re: How to get the cursor position after select object.

[ Edited ]

Oh~ I didn't know you left answer at Eng-tip.

Thank you very much for your answer.

 

In GTAC Solution center, I found two samples.

 

One is Sample NX Open .NET Visual Basic program : create idsymbol with blockstyler

 

And other one is Sample NX Open .NET Visual Basic program : create idsymbol with blockstyler nx85

 

Sample for nx85, didn't use GetPoint() method.

So I thought first sample is for under NX8.5.

 

----------------------------

Dim cursor As Point3d = selection0.PickPoint

Dim screen_pos As Point3d = cursorLocation0.CursorLocation

----------------------------

 

Thank you again.