VS:ConvertToArcPolyline: Difference between revisions

From Vectorworks Developer
Jump to navigation Jump to search
m (1 revision)
 
m (fix)
 
(7 intermediate revisions by the same user not shown)
Line 5: Line 5:
-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
<desc>
<desc>
Converts a poly to a poly with only corner and arc vertices.
Convert, within a tolerance, the input polyline into an polyline that uses arcs for the curves.</desc>
</desc>


-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
<def>
<def>
<funcDef lang="vs">
<funcDef lang="vs">
FUNCTION ConvertToArcPolyline(hPolygon :HANDLE; dFuzz :REAL) :HANDLE;
FUNCTION ConvertToArcPolyline(hPolygon:HANDLE; dFuzz:REAL) : HANDLE;
</funcDef>
</funcDef>
<funcDef lang="py">
<funcDef lang="py">
Line 34: Line 33:
</lineList>
</lineList>
</params>
</params>
-----------------------------------------------------------------------------------------------------------
<return>
</return>


-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
<remark>
<remark>
([[User:CBM-c-|_c_]], 2022.02.02) This routine must be updated, it still doesn't recognize Radius vertexes.


As of VW 2022  the routine behaves on vertexes as such:
* corner: preserved
* arc: preserved only on dFuzz = 0, otherwise they turn into corner, which is truly strange, since the purpose IS to create arc vertexes
* radius: ignored, turn into corner
* cubic: turn into arc
* bezier: turn into arc
</remark>
</remark>


-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
<sample>
<sample>
==== VectorScript ====
<code lang="pas">
<code lang="pas">
PROCEDURE Example;
PROCEDURE Test;
VAR
VAR
  h :HANDLE;
    polyObj, newPolyObj : HANDLE;
BEGIN
BEGIN
  CallTool(-204);
    { select a polyline }
  h := ConvertToArcPolyline(FSActLayer, .1);
    polyObj := FSActLayer;
    IF polyObj <> NIL THEN BEGIN
        newPolyObj := ConvertToArcPolyline(polyObj, 0);
        SetDSelect(polyObj);
    END;
END;
END;
RUN(Example);</code>
Run(Test);
</code>


==== Python ====
<code lang="py">
# select a polyline
polyObj = vs.FSActLayer()
if polyObj != vs.Handle( 0 ):
newPolyObj = vs.ConvertToArcPolyline(polyObj, 0)
vs.SetDSelect(polyObj)
</code>
</sample>
</sample>
-----------------------------------------------------------------------------------------------------------
<seeAlso></seeAlso>


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


This is drop-in function.
</version>
</version>
-----------------------------------------------------------------------------------------------------------
<seeAlso>
</seeAlso>


</vwDoc>
</vwDoc>


[[Category:VS Function Reference|ConvertToArcPolyline]]
[[Category:VS Function Reference|ConvertToArcPolyline]]
[[Category:VS Function Reference:Objects - 2D|ConvertToArcPolyline]]
[[Category:VS Function Reference:Graphic Calculation|ConvertToArcPolyline]]

Latest revision as of 06:30, 3 February 2022

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

Description

Convert, within a tolerance, the input polyline into an polyline that uses arcs for the curves.

FUNCTION ConvertToArcPolyline(
hPolygon :HANDLE;
dFuzz :REAL) : HANDLE;
def vs.ConvertToArcPolyline(hPolygon, dFuzz):
    return HANDLE

Parameters

hPolygon HANDLE
dFuzz REAL

Remarks

(_c_, 2022.02.02) This routine must be updated, it still doesn't recognize Radius vertexes.

As of VW 2022 the routine behaves on vertexes as such:

  • corner: preserved
  • arc: preserved only on dFuzz = 0, otherwise they turn into corner, which is truly strange, since the purpose IS to create arc vertexes
  • radius: ignored, turn into corner
  • cubic: turn into arc
  • bezier: turn into arc

Example

VectorScript

PROCEDURE Test;
VAR
    polyObj, newPolyObj : HANDLE;
	
BEGIN
    { select a polyline }
    polyObj := FSActLayer;
    IF polyObj <> NIL THEN BEGIN
        newPolyObj := ConvertToArcPolyline(polyObj, 0);
        SetDSelect(polyObj);
    END;
END;
Run(Test);

Python

# select a polyline
polyObj = vs.FSActLayer()
if polyObj != vs.Handle( 0 ):
	newPolyObj = vs.ConvertToArcPolyline(polyObj, 0)
	vs.SetDSelect(polyObj)

Version

Availability: from Vectorworks 2014