Jump to content
Developer Wiki and Function Reference Links ×

regeneration


ccroft

Recommended Posts

parmname := 'BAD";

parmhand := whatever;

etc;

resultstatus := you know the rest

Can someone tell me what exactly this is doing and why? I've noticed that some examples have this and some don't. Some comment {standard call for regeneration of an object}. Others say {get regeneration info}.I haven't used it yet and I'm wondering if I should.

Under what circumstances is this advixable?

I've read the function reference and Custom Solutions and I have what amounts to some superstitions about this whole thing.....nothing coherent.

I do understand that if GetCustomInfo returns false then nothing happens.So....what will cause it to return false?

"is used within PIO scripts to determine information about the object". Trippy!

Help me understand this and at what point a PIO exists such that info can be gotten about it.

Thankyou

Charles

Link to comment

A VectorScript Plug-in Object can call the function GetCustomObjectInfo( ) to get information about itself. This function should only be called from within a Plug-in Object script. It returns the name of the object and a handle to the plug-in object instance in the drawing. It also returns a handle to the record that contains current values for the object's parameters. This handle is not that useful since you have access to the parameter values through the constants, and GetRField/SetRField take the name of the record not a handle. If the plug-in object is inserted into a wall, then this function returns a handle to the wall object. This can be useful if the object wants to know the width of the wall or other attributes of the wall.

So to answer some of your questions...it is advisable to call this function if you need any of the information that it returns to you. You are not required to call it, but since it is merely returning some information it is an inexpensive call and there is really no speed penalty for calling it.

The function returns true if the object handle and the record handle are both valid (not null). This should always be true when a VectorScript Plug-in Object is regenerating. If it returned false during regen it would indicate a corruption in the VectorScript system.

One other note...the sample script that contains the statement parmName := "BAD"; is simply initializing the string variable to something that is not likely to be an actual object name. You could test for 'BAD' after the call to GetCustomObjectInfo to make sure an actual name was returned. The script could just as easily have initialized the parmname variable to empty string '' or something else.

Hope this clears it up a little. Let me know if you have any more questions.

Thanks

Jeff Koppi

jkoppi@nemetschek.net

Link to comment

Thanks Jeff!

I think you answered all my questions. On "the nature of existence" part,it's now obvious to me that a PIO knows all about itself before it manifests itself in the drawing.Of course it has to so that if can draw correctly,but I had something in my head like "if it doesn't exist yet,how can it have a handle?"

I'm working on a PIO in which the dims of one part of a sub-assembly is computed from the parameters of the other parts. It would be useful to see this dimension in the OIP,even tho it's not, strictly speaking, a parameter of the PIO.

From your reply this seems like a workable idea thru SetRField. The handle to the PIO will be provided by GetCustomObjectInfo.Now I need the name of the record.Is this the same as the name of the PIO?Should the field in which this dimension would be displayed be formatted as text so it can accept the string provided by SetRField? I guess I'd use Num2StrF to convert the dim to a string that SetRField could use.

Please let me know if I'm on the right track here.Any tips you have on this would be greatfully recieved.

Thanks again

Charles

Link to comment

Charles,

You can think of a Plug-in Object "node" as a type of container, similar to a group node. When a new instance is created, a plug-in object node is created in the drawing. It has an attached record node to store its parameter values, but it initially has an empty sub-list. Then VectorWorks calls the object's script to "regenerate". At this point the script can get a handle to the object using GetCustomObjectInfo( ). It is a valid handle, but again it is an empty container until the script finishes. The script simply creates the sub-objects that define the object. These sub-objects are placed in the sub-list of the plug-in object.

Yes, the name of the plug-in object is the same as the name of the record.

The parameter can be a number field or string (text) field. You can convert to a string before calling SetRField if necessary.

You are on the right track!

Jeff

Link to comment

Thanks so much for your help!

I'd just like to say how much I appreciate v-script.It just makes sense. I was looking at some LISP scripts for A-cad .Yikes.....what a mess.

I also really appreciate the level of support you give on these forums.

See you later.

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