Jump to content
Developer Wiki and Function Reference Links ×

Trigger a specific Event on an Object


DomC

Recommended Posts

Hello
The question is maybe naive. As I know, there are Events that happens while the usage or code-run of an object. As example 3 for reset, 5 initProberties etc. Is it possible at all, to fire such an event on a PIO from outside. Or trigger the PIO with something more controlled than vs.ResetObject()?

To be specific:
1. Fire a standard-Event like 3 (I think vs.ResetObject() does that) or 41 or 43?

2. Or a custom event. Lets say I have a button ID inside the PIO like:
(theEvent, theButton) = vs.vsoGetEventInfo( )

With simple words: Can I push the button from outside with something other than the Mouse cursor?

Thanks 
DomC
 

Link to comment

You can't create your own event types, but you can tag along an existing one.

 

I think you are overthinking this. What about using a parameter value to execute that specific action? That way, you only need to trigger the action by setting that record field/parameter to a specific value prior to resetting the object. Your object code can filter that value and decide what to do during the recalculate event.

Setting that value and resetting the object can be done from anywhere as long as you have a refrence (HANDLE) to that object.

 

  • Like 2
Link to comment

You can trigger the reset event via ResetObject(). You can use states to see if the reset was internal (e.g. changing a parameter or moving) or triggered by the call. You can also use the string repository to pass information to the PIO
In terms of triaging a button event or the tool, if the event is from another one of your scripts, you can structure you code to run from the same includes. For example, construct an include file that takes a handle to your PIO as a parameter. Pressing a button on the PIO would pass the PIO’s handle to the function. Running a menu command would invoke ForEachObject() with your function as the callback. 

Link to comment

Thank you for that feedback Hippocode and JBenghiat. 
Of course you are absolutely right. I should have been more specific about what I'm trying to do in the first place. I have a script that reshapes interiorcad cabinets together with custom parts and milling pios which are attached to that objects.
Unfortunately, applying a vs.ResetObject() to these objects disconnect their connections to the fittings and other associated elements. The PIO itself runs a code, that is able (if nothing went wrong) to keep that relations. 
So there are some options:
1. The developper of that PIOs implements an API which can be triggered by vs.ResetObject()
2. I find a way to fire the right events to that PIO so that it is forced to regenerate (It also has a button to update)
3. It is maybe a bug in the vs.ResetObject()

#1 is maybe the best option but if it can be controlled by the script itself it would be seen prefered.
Here what the script does. It is open source and addresses a very often mentioned requirement from customers.
 


 

Edited by DomC
Link to comment

@DomC thanks for the further information. 
 

I think you have two possibilities— either your script is not resetting the object, or the “update” button does more than just trigger the regenerate event. 
 

Generally, calling ResetObject() won’t actually trigger the reset event until after your script completes, so for example, if setting parameter a affects parameter b, calling:

SetRField(a)

ResetObj()

GetRField(b)

 

will return a value of b as if a had not changed (because it hasn’t yet). 
 

If this is your scenario, and the cabinet object is SDK based, which I believe it is, you can use 

ovParametricImmediateReset                    = 1167

on the PIO to force the reset before continuing on your script. 
 

If the cabinet has parameters that depend on each other, for example a change an affects b and changing b affects a, the PIO likely detects OIP changes and responds accordingly. As far as I know, there’s no way to trigger a parameter change as though it was made by the user. SetRField() directly changes the object’s parameters without triggering any state change events. 
 

In that case, I recommend contacting the interiorcad folks and seeing if they can provide a specific solution. 

  • Like 1
Link to comment

vs.ResetObject() actually regenerates the pio and change the geometry after with vs.SetRField() parameters are changed and I tried also 1167. The specific thing here is, that the cabinet contains also plugins (Custom Parts) which maybe are not reseted as expected and the additional relations of fittings interact with the parts and not directly with the cabinet maybe. I will give accessing the sub-pios of the cabinet and if that not will not be of use i will wait for another solution. 

Already I am in contact with the genius devs from extragroup but there are always some other more important tasks to address so I wondered if i could bypass this limitation on the script-side.
 

Link to comment
2 minutes ago, DomC said:

vs.ResetObject() actually regenerates the pio and change the geometry after with vs.SetRField() parameters are changed and I tried also 1167. The specific thing here is, that the cabinet contains also plugins (Custom Parts) which maybe are not reseted as expected and the additional relations of fittings interact with the parts and not directly with the cabinet maybe. I will give accessing the sub-pios of the cabinet and if that not will not be of use i will wait for another solution. 

Already I am in contact with the genius devs from extragroup but there are always some other more important tasks to address so I wondered if i could bypass this limitation on the script-side.
 

 

As there are a lot of possibilities in how subobjects are generated and can interact with eachother and parent objects this can be hard to do. Lets hope they find the time to help you out 😉

Link to comment

If you’re not familiar with DebugListView, give a search for other threads on the forum. It lets you browse the drawing structure and see all the hidden fields for an object. You may be able to deduce where the id’s for the child objects get stored so that you can also tell them to reset. 

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...