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

0 Members and 1 Guest are viewing this topic.

xdcad

  • Bull Frog
  • Posts: 424
[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
Adesk::Boolean
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)))
  10.          (setq p1 (cadr 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.      (progn
  26.        (if (= typ "kNurbCurve3d")
  27.          (progn
  28.            (mapcar 'set '(from to) (vl-sort (list pam1 pam2) '<))
  29.            (xdge::setpropertyvalue ge "hardTrimByParams" from to)
  30.            ;|
  31.               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.  
  32.            |;
  33.          )
  34.          (progn
  35.            ;;(mapcar 'set '(from to) (vl-sort (list pam1 pam2) '<))
  36.            (setq in (xdge::constructor "AcGeInterval" pam1 pam2))
  37.            (xdge::setpropertyvalue ge "setInterval" in)
  38.          )
  39.        )
  40.        (setq e (xdge::entity:make ge))
  41.        (xdrx_entity_setcolor (entlast) 1)
  42.        (xd::drag:simplemove e "\nInsert Point:" 5 t)
  43.      )
  44.      (xdge::free)
  45.   )
  46.   (princ)
  47. )

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

The above LISP code uses the XDRX-API, which can be downloaded from https://github.com/xdcad/XDrx-API

The XDRX API encapsulates AcDb, AcEd, AcGe, AcBr... C++ library, using C++ methods to develop LISP programs.Thousands of Lisp functions are available.
Modify message
« Last Edit: November 18, 2023, 05:53:38 AM by xdcad »
The code I wrote uses XDRX-API,which can be downloaded from github.com and is updated at any time.
===================================
[XDrx-Sub Forum]
https://www.theswamp.org/index.php?board=78.0
https://github.com/xdcad/XDrx-API
http://bbs.xdcad.net