Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

NXOpen.BlockStyler.UIBlock 2

Status
Not open for further replies.

Zoes

Mechanical
Sep 30, 2011
46
GB
Hi all,

I'm new to NXopen and I have a quite silly question; how I add items in a listbox and bitmaps in a dialog created by the blockstyler?
I thought the obvious answer will be something like this:
Public Function update_cb(ByVal block As NXOpen.BlockStyler.UIBlock) As Integer
Try
If block Is list_box0 Then
Dim list_box0Props As PropertyList = list_box0.GetProperties()
list_box0Props.AddItem("value")
End If

But I’m getting the error that “AddItem” is not a member NXOpen.Blockstyler.Property. What I’m doing wrong?

Thanks,
Zoes
 
Replies continue below

Recommended for you

So the expression updates if it exists (Tools-> Expression; I can see that "thickness" has been updated), but is not being applied to the work part. Is that correct?
 
Zoes said:
...but is not being applied to the work part.

I'm not exactly sure what you mean. It should depend on how the expression is being used in the (work) part...

Marc
NX Software Developer
 
Well, when you use the UI dialog box to update the "thickness, for e.g to 20mm, the actual value in the expression list indeed updates to 20mm but I can not see the work part "thicken" by 20mm. Does that make sense?
In order for the new value to be applied to the work part you need to go Tools-> Expressions -> Apply, then you can see the workpart increase size.

Is there any code line to update the workpart based on the current expressions's values? Update (regenerate) the display?
 
Interesting... perhaps a forced interpart update is necessary, or the behavior is due to your NX settings. I will take a look and let you know.

Marc
NX Software Developer
 
Thank you Mark.

I wonder if it has to do with something like that:

Dim markId3 As Session.UndoMarkId
markId3 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Update Expression Data")
 
If that were the case, then your expression would have its old value. Undo marks are usually used to rollback any changes in case of an error (as an example).

Marc
NX Software Developer
 
Any ideas for re-drawing the object based on the user input on a dialog box?
 
I just tried it. It works perfectly for me. Are you sure your expression is used with your model?

Marc
NX Software Developer
 
Yes. The value thickness is an expression in use in the model.
 
Which NX version are you using? I think it would also be a good idea if you sent me your model. I have a strong feeling that the issue has to do with some NX settings...

Marc
NX Software Developer
 
Worked for me. The issue is either the code or some NX setting I am unaware of.

Marc
NX Software Developer
 
Thank you Mark. Will look into it.
 
Very curious why it worked for you. Tried a different machine today and didn't work either.
 
Can you perhaps send a screenshot of your Custom Settings?
 
Got it. Just needed an update of the id Session;

nErrs1 = theSession.UpdateManager.DoUpdate(id1)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top