### Author Topic: [AcGe(3)]Cut out the part inside the curve  (Read 1268 times)

0 Members and 1 Guest are viewing this topic.

• Swamp Rat
• Posts: 528
##### [AcGe(3)]Cut out the part inside the curve
« on: November 18, 2023, 05:47:24 AM »

ARX ​​function prototype

SPLINE:

AcGeNurbCurve3d::hardTrimByParams Function
AcGeNurbCurve3d &
hardTrimByParams(
double newStartParam,
double newEndParam);

 newStartParam Enter new parameters for spline start point newEndParam Enter new parameters for spline end point

Clipping the spline using new start and end parameters. This is accomplished by adding and removing control points and nodes, rather than resetting the spacing that defines the spline.

Other Curve:

AcGeCurve3d::setInterval Function
setInterval(
const AcGeInterval& intrvl);

Main functions:
(xdge::setpropertyvalue ge "hardTrimByParams" from to)
(xdge::setpropertyvalue ge "setInterval" in)

Code - Auto/Visual Lisp: [Select]
1. (defun c:tt (/ e ge p1 p2 pam1 pam2 in typ from to)
2.   (if
3.     (and (setq
4.            e (xdrx_entsel
5.                "\nPick Curve: "
6.                '((0 . "LWPOLYLINE,ARC,LINE,ELLIPSE,CIRCLE,SPLINE"))
7.              )
8.          )
9.          (setq ge (xdge::constructor (car e)))
11.          (setq p2 (getpoint p1 "\nSecond Point: "))
12.          (setq pam1 (xdge::getpropertyvalue
13.                       ge
14.                       "paramOf"
15.                       (xdge::getpropertyvalue ge "closestPointTo" p1)
16.                     )
17.                pam2 (xdge::getpropertyvalue
18.                       ge
19.                       "paramOf"
20.                       (xdge::getpropertyvalue ge "closestPointTo" p2)
21.                     )
22.          )
23.          (setq typ (xdge::type ge))
24.     )
25.        (if (= typ "kNurbCurve3d")
26.            (mapcar 'set '(from to) (vl-sort (list pam1 pam2) '<))
27.            (xdge::setpropertyvalue ge "hardTrimByParams" from to)
28.            ;|
29.               Trims the spline to the new start and end parameters. This is done by adding and removing control points and knots, and is not done by just resetting the interval on which the spline is defined.
30.            |;
31.          )
32.            ;;(mapcar 'set '(from to) (vl-sort (list pam1 pam2) '<))
33.            (setq in (xdge::constructor "AcGeInterval" pam1 pam2))
34.            (xdge::setpropertyvalue ge "setInterval" in)
35.          )
36.        )
37.        (setq e (xdge::entity:make ge))
38.        (xdrx_entity_setcolor (entlast) 1)
39.        (xd::drag:simplemove e "\nInsert Point:" 5 t)
40.      )
41.      (xdge::free)
42.   )
43.   (princ)
44. )

=============