VS:BeginContext: Difference between revisions

From Vectorworks Developer
Jump to navigation Jump to search
m (1 revision)
 
(add remark)
Line 5: Line 5:
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
<desc>
<desc>
Use this function in conjuction with EndContext to starts logging changes that are made until the EndContext is reached.</desc>
Use this function in conjuction with [[VS:EndContext]] to starts logging changes that are made until the EndContext is reached.</desc>


-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
Line 20: Line 20:
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
<remark>
<remark>
If you do not use this construct and you create a temporary plug-in object that itself creates a new class, the new class will remain even after you delete the temporary plug-in object.


Use this to begin a logical block of code that creates construct geometry that you intend to delete yourself, and which you don't need to be added to the undo list. For example, if creating a temp symbol for use in a symbol display control, use this so VW won't bog down adding all of the symbol geometry to the undo list.


Use this to begin a logical block of code that creates construct geometry that you intend to delete yourself, and which you don't need to be added to the undo list. For example, if creating a temp symbol for use in a symbol display control, use this so VW won't bog down adding all of the symbol geometry to the undo list.</remark>
([[User:Orso.b.schmid|Orso]] 2010.02.10): Begin/EndContext(0) doesn't terminate well if you create hatch definitions. These resources create nevertheless, only their name is removed from the name list. You end up with a nameless resource, even if you delete it before exiting with EndContext(0). (tested VW13 thru 15)
 
([[User:Orso.b.schmid|Orso]] 2009.05.25): Begin/EndContext don't deal with colors created during the script, for example through PenFore(r, g, b). Even if you terminate the call with EndContext(0) the created colors are there. Actually color creation cannot be undone at all, both as user as well as scripter. (VW 13, 14).
 
([[User:Orso.b.schmid|Orso]] 2009.04.05): Begin/EndContext must be used in the same procedure block, otherwise they don't work. You can't begin context in a procedure/function and end it somewhere else. This is valid for Commands at least.
 
([[User:Orso.b.schmid|Orso]] 2008.11.03): This causes troubles to the undo list if you use it through AppleScript in VW 2009. You shouldn't use it through AS until this is fixed.
 
(unsigned:) If you do not use this construct and you create a temporary plug-in object that itself creates a new class, the new class will remain even after you delete the temporary plug-in object.
 
</remark>


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

Revision as of 13:26, 16 February 2016

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

Description

Use this function in conjuction with VS:EndContext to starts logging changes that are made until the EndContext is reached.

PROCEDURE BeginContext;
def vs.BeginContext():
    return None

Remarks

Use this to begin a logical block of code that creates construct geometry that you intend to delete yourself, and which you don't need to be added to the undo list. For example, if creating a temp symbol for use in a symbol display control, use this so VW won't bog down adding all of the symbol geometry to the undo list.

(Orso 2010.02.10): Begin/EndContext(0) doesn't terminate well if you create hatch definitions. These resources create nevertheless, only their name is removed from the name list. You end up with a nameless resource, even if you delete it before exiting with EndContext(0). (tested VW13 thru 15)

(Orso 2009.05.25): Begin/EndContext don't deal with colors created during the script, for example through PenFore(r, g, b). Even if you terminate the call with EndContext(0) the created colors are there. Actually color creation cannot be undone at all, both as user as well as scripter. (VW 13, 14).

(Orso 2009.04.05): Begin/EndContext must be used in the same procedure block, otherwise they don't work. You can't begin context in a procedure/function and end it somewhere else. This is valid for Commands at least.

(Orso 2008.11.03): This causes troubles to the undo list if you use it through AppleScript in VW 2009. You shouldn't use it through AS until this is fixed.

(unsigned:) If you do not use this construct and you create a temporary plug-in object that itself creates a new class, the new class will remain even after you delete the temporary plug-in object.

Version

Availability: from VectorWorks 12.5

See Also

VS Functions:

VS:EndContext

VS Functions: [[VS:EndContext]]