Difference between revisions of "VS:OffsetHandle"

From Vectorworks Developer
Jump to: navigation, search
(add remark, example: dangerous, no undo)
m (fix typo)
Line 81: Line 81:
 
END;
 
END;
 
END;
 
END;
Run(tryOffsetH);</code">
+
Run(tryOffsetH);</code>
 
</sample>
 
</sample>
  

Revision as of 03:33, 25 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 a polygon/polyline, 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 grab the handle. This is dangerous, if the routine fails, LObject will be something else: store LObject before running the script and afterwards and compare. If they are different the routines succeeded.
VW 2014
the handle will set as expected, undo still fails

Example

PROCEDURE tryOffsetH;
VAR
	prevLObj, sourcePoly, h : HANDLE;
	temp_b : BOOLEAN;
BEGIN
	sourcePoly := FSActLayer;

	IF (sourcePoly <> NIL) THEN BEGIN
		{ bug: h2 won't set with OffsetHandle until VW 2014 }
		prevLObj := LObject; { store for later comparison }

		h := OffsetHandle(sourcePoly, -10, TRUE, TRUE); { negative offset -10mm }
		h := LObject; 

		IF (prevLObj <> NIL) & (prevLObj <> h) THEN BEGIN
			Message('Type: ', GetType(h), ' - ', h);
			ResetObject(h);
			HUngroup(h);
			SetDSelect(sourcePoly);
		END;
	END;
END;
RUN(tryOffsetH);

Version

Availability: from Vectorworks 2014

See Also

Similar calls:
Similar calls:
  • [[VS:OffsetPoly]]
  • [[VS:OffsetPolyN]]
Personal tools
NamespacesFFFF

Variants
Actions
Advanced Search
See Also
Navigation
Toolbox