VS:IsNewCustomObject

From Vectorworks Developer
Revision as of 02:12, 19 February 2016 by Orso.b.schmid (Talk | contribs)

Jump to: navigation, search

.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix

Description

Function IsNewCustomObject returns whether the specified plug-in object is a new object, indicating that the object is being regenerated for the first time.


New object status is useful in specifying initialization and setup data, as well as calling initialization specific subroutines. This function should only be called in plug-in objects.

FUNCTION IsNewCustomObject(
objectName  :STRING) : BOOLEAN;
def vs.IsNewCustomObject(objectName):
    return BOOLEAN

Parameters

objectName STRING Name of plugin object.

Remarks

Call from CustomObject scripts only. Returns true for new objects, meaning this is the first time the regeneration script is being called.

Returns false when a new object is placed into a wall, due to the dual regen issue. What you have to do is to create an invisible parameter to trap the new status on the first regen, then check that parameter in the second regen, react accordingly, then reset the parameter to its default value.

So this will evaluate on the first regen:

IF IsNewCustomObject(MyObject) & p__IsNew THEN 
    SetRField(ghParm, MyObject, '__IsNew', 'True');

And this on the second regen:

IF p__IsNew & (hWall <> NIL) THEN BEGIN
    SetRField(ghParm, MyObject, '__IsNew', 'False' );
    DoMyStuffHere...
END;

(Orso 2008.04.05): IsNewCustomObject will never return TRUE on: objects created by VS:CreateCustomObjectPath, objects duplicated by alt-click + drag, by Duplicate command etc.

Version

Availability: from VectorWorks 8.0

See Also

VS Functions:

VS:GetCustomObjectInfo

VS Functions: [[VS:GetCustomObjectInfo]]
Personal tools
NamespacesFFFF

Variants
Actions
Advanced Search
See Also
Navigation
Toolbox