VS:OffsetHandle: Difference between revisions

From Vectorworks Developer
Jump to navigation Jump to search
m (1 revision)
 
(clearer var names)
(7 intermediate revisions by the same user not shown)
Line 5: Line 5:
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
<desc>
<desc>
Offsets the specified object.
Creates a group of lines which represent the weighted medial axis of given polygon.</desc>
</desc>


-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
<def>
<def>
<funcDef lang="vs">
<funcDef lang="vs">
FUNCTION OffsetHandle(h :HANDLE; offsetDistance :REAL; EdgeRestoration :BOOLEAN; FilletSharpEdges :BOOLEAN) :HANDLE;
FUNCTION OffsetHandle(h:HANDLE; offsetDistance:REAL; EdgeRestoration:BOOLEAN; FilletSharpEdges:BOOLEAN) : HANDLE;
</funcDef>
</funcDef>
<funcDef lang="py">
<funcDef lang="py">
Line 44: Line 43:
</lineList>
</lineList>
</params>
</params>


-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
<return>
<remark>
</return>
([[User:Orso.b.schmid|Orso]], 2014.03.25): The routine was introduced undocumented by VW11 (2006).
Warning:
* The parameter ''offsetDistance'' takes mm, unregarded unit's settings.
* If you pass a polygon/polyline it outputs a group containing one or more polygon/polylines, not a group of lines.
* Polyline holes are ignored
* Undo fails on this action: you should consider carefully if using this routine


-----------------------------------------------------------------------------------------------------------
; VW 2011, 2012, 2013: the handle ''h'' doesn't set. Use [[VS:LObject| LObject]] to fetch the handle. This is dangerous, if the routine fails, LObject will be something else: store LObject before running the script and afterwards, then compare. If they are different the routine succeeded.
<remark>
; VW 2014: the handle will set as expected, undo still fails
[[User:Orso.b.schmid|Orso]] (2008 Mar 16): "offsetDistance" takes page mm. It is quite crashy under VW 13 (83388).
</remark>
</remark>


-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
<sample>
<sample>
==== VectorScript ====
<code lang="pas">PROCEDURE try;
VAR
prevLObj, sourceObj, groupObj : HANDLE;
BEGIN
sourceObj := FSActLayer;
IF (sourceObj <> NIL) THEN BEGIN
{ h won't set with OffsetHandle until VW 2014 }
prevLObj := LObject; { only before VW 2014: store for later comparison }
groupObj := OffsetHandle(sourceObj, -10, TRUE, TRUE); { negative offset -10mm }
groupObj := LObject; { only before VW 2014: this should be now the product of OffsetHandle }
IF (prevLObj <> groupObj) THEN BEGIN
Message('Type: ', GetType(groupObj));
ResetObject(groupObj);
HUngroup(groupObj);
SetDSelect(sourceObj);
END;
END;
END;
Run(try);</code>
==== Python ====
<code lang="py">


</code>
</sample>
</sample>
-----------------------------------------------------------------------------------------------------------
<seeAlso>
Similar calls:
* [[VS:OffsetPoly]]
* [[VS:OffsetPolyN]]
</seeAlso>


-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
<version>
<version>
Availability: from All Versions
Availability: from Vectorworks 2014


This is drop-in function.
</version>
</version>
-----------------------------------------------------------------------------------------------------------
<seeAlso>
[[VS:OffsetPoly| OffsetPoly]]
[[VS:OffsetPolyN| OffsetPolyN]]
</seeAlso>


</vwDoc>
</vwDoc>


[[Category:VS Function Reference|OffsetHandle]]
[[Category:VS Function Reference|OffsetHandle]]
[[Category:VS Function Reference:Objects - Polys|OffsetHandle]]
[[Category:VS Function Reference:Object Editing|OffsetHandle]]

Revision as of 05:55, 26 March 2014

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

Description

Creates a group of lines which represent the weighted medial axis of given polygon.

FUNCTION OffsetHandle(
h :HANDLE;
offsetDistance :REAL;
EdgeRestoration :BOOLEAN;
FilletSharpEdges :BOOLEAN) : HANDLE;
def vs.OffsetHandle(h, offsetDistance, EdgeRestoration, FilletSharpEdges):
    return HANDLE

Parameters

h HANDLE
offsetDistance REAL
EdgeRestoration BOOLEAN
FilletSharpEdges BOOLEAN

Remarks

(Orso, 2014.03.25): The routine was introduced undocumented by VW11 (2006).

Warning:

  • The parameter offsetDistance takes mm, unregarded unit's settings.
  • If you pass a polygon/polyline it outputs a group containing one or more polygon/polylines, not a group of lines.
  • Polyline holes are ignored
  • Undo fails on this action: you should consider carefully if using this routine
VW 2011, 2012, 2013
the handle h doesn't set. Use LObject to fetch the handle. This is dangerous, if the routine fails, LObject will be something else: store LObject before running the script and afterwards, then compare. If they are different the routine succeeded.
VW 2014
the handle will set as expected, undo still fails

Example

VectorScript

PROCEDURE try;
VAR
	prevLObj, sourceObj, groupObj : HANDLE;
BEGIN
	sourceObj := FSActLayer;
	IF (sourceObj <> NIL) THEN BEGIN

		{ h won't set with OffsetHandle until VW 2014 }
		prevLObj := LObject; { only before VW 2014: store for later comparison }

		groupObj := OffsetHandle(sourceObj, -10, TRUE, TRUE); { negative offset -10mm }
		groupObj := LObject; { only before VW 2014: this should be now the product of OffsetHandle }

		IF (prevLObj <> groupObj) THEN BEGIN
			Message('Type: ', GetType(groupObj));
			ResetObject(groupObj);
			HUngroup(groupObj);
			SetDSelect(sourceObj);
		END;
	END;
END;
Run(try);

Python


Version

Availability: from Vectorworks 2014

See Also

Similar calls:

Similar calls:
  • [[VS:OffsetPoly]]
  • [[VS:OffsetPolyN]]