Jump to content

(command "splinedit") -> fit data -> add = what is a "fit point"?


vanowm

Recommended Posts

Hello.

I'm trying add a fit point to a spline, for that I'm trying to use splinedit command:

(command "splinedit" (entsel) "f" "a" (getpoint))

However, when I click on highlighted fit point (osnap is disabled), it complains with: "Not a fit point"

I made sure that my point coordinates are exactly as the fit point coordinates I've clicked on.

 

I also tried use vlax-curve-getClosestPointTo it produced same error.

 

So, what is a "fit point" exactly? a set of coordinates, an index, an object?

 

P.S.

I do realize it's not complete command, I'm just stuck at this stage of the command, before new point coordinates can be supplied.

Edited by vanowm
Link to comment
Share on other sites

Posted (edited)

Was I supposed to combine different questions into one topic? This is related to splines, but it has nothing to do with my other 2 questions about splines...

Edited by vanowm
Link to comment
Share on other sites

  • vanowm changed the title to splinedit -> fit data -> add = what is a "fit point"?

@vanowm read up on AutoCAD splines.   A god place to start is here:

https://help.autodesk.com/view/ACDLT/2024/ENU/?guid=GUID-5E7D51E2-1595-4E0C-85F8-2D7CBD166A08

 

Spline do not have grips but may ( but do not need to) have Fit Points if the "fit point method" was used to create it with the spline command.  A pline created from a polyline with the spline option will not have fit points, only CV points.

Link to comment
Share on other sites

Sorry, but that does not answer my question. I understand the difference between fit and control points of a spline and how to use splinedit command within autocad itself.

My question is how to use splinedit command in autolisp.

Link to comment
Share on other sites

What steps have you taken to learn about the splinedit command. Is there a particular option to the command that you have a question about?

Link to comment
Share on other sites

Did you actually read my question? You do realize, that splinedit and (command "splinedit") are two different things, right?

In autocad (command) is not necessarily the same as just typing a command, it sometimes has different options. I can't find any information about how to use (command "splinedit") hens is this post.

Link to comment
Share on other sites

  • vanowm changed the title to (command "splinedit") -> fit data -> add = what is a "fit point"?
On 13/04/2024 at 22:52, vanowm said:

So, what is a "fit point" exactly? a set of coordinates, an index, an object?


Those blue square points are fit points, first image attached. You have to click on it, and whether you have snap option on or off it should snap to it because you need to select it (square turns red), second attached image. If you are not able to select it like that, maybe you have to edit some snap or drafting options.

image1.png

image2.png

Link to comment
Share on other sites

(command "splinedit" (entsel) "f" "a" (getpoint))

 

Works fine on AutoCAD 2000i on my home computer and AutoCAD 2024 at work.

 

What exactly are you trying to accomplish?

 

VLISP and VBA have AddFitPoint if that's an option.

 

AutoCAD 2022 Developer and ObjectARX Help | FitPoints Property (ActiveX) | Autodesk

 

Quote

Remarks

The fit points define the path of the spline. You can change the tolerance of a given fit point by using the FitTolerance property. You can add a fit point by using the AddFitPoint method. You can delete a fit point by using the DeleteFitPoint method. You can query the location of a fit point by using the GetFitPoint method. You can change the location of a given fit point by using the SetFitPoint method.

 

Quote

So, what is a "fit point" exactly? a set of coordinates, an index, an object?

 

It is an object.

Link to comment
Share on other sites

Posted (edited)
1 hour ago, SLW210 said:
(command "splinedit" (entsel) "f" "a" (getpoint))

 

Works fine on AutoCAD 2000i on my home computer and AutoCAD 2024 at work.

 

....

 

It is an object.

That's kind of contradicts...how can it "work fine" if it's an "object"? the (getpoint) returns a list of coordinates, not an object.

 

I know how to add/remove fit points with activeX, it's not the question here. I'm trying to understand how exactly can we use (command "splitedit" (entsel) "f" "a") to add new fit points.

At that stage of the command, what exactly do we need to supply the command with?(without human interaction, human interaction would be acceptable at the step after that, were coordinates for a new fit point supplied)

I'm not looking for alternatives or work arounds. This is more for a general knowledge, rather than practical use.

Edited by vanowm
Link to comment
Share on other sites

Fit points are...points. Dxf group code 11.

I'm still not sure what are you exactly trying to do, but from your last post you are trying to add new fit points with lisp WITHOUT clicking point, no human interaction?

Something like this maybe?
 

(command "splinedit" (entsel) "f" "a" (nth n FitPointList) NewPoint "" "" "" "")

Where "FitPointList" is a list of spline Fit points, you are selecting the nth element
NewPoint is new point you want to add

See this for example

(defun c:test ( / ASSOCK_lst spline FitPointList NewPoint n)
  (defun ASSOCK_lst (EntDef code / out)
    (while (setq values (assoc code EntDef))
      (setq out (append out (list (cdr values))))
      (setq EntDef (cdr (member values EntDef)))
    )
    out
  )
  (setq spline (car (entsel "Select SPLINE")))
  (setq FitPointList (ASSOCK_lst (entget spline) 11))
  (setq n (getint (strcat "Enter Fit point number [1-" (itoa (length FitPointList)) "]: ")))
  (setq NewPoint (getpoint (nth (- n 1) FitPointList) "\nGet new point to add to SPLINE\n"))
  (command "splinedit" spline "f" "a" (nth (- n 1) FitPointList) NewPoint "" "" "" "")
  )



 

Edited by lastknownuser
  • Thanks 1
Link to comment
Share on other sites

I don't think of a fit point as an object but as a location in 3D space.  A spline is an object.

 

I you want to add a fit point in LISP to a spline that has fit points you just mimic the command options for the splinedit command.

 

For example.  Given a spline with fit points:

1,1

2,3

4,1

6,2

 

and lets assume that you want to add a fit point with the coordinate 4.5,1.5 between the 3rd and 4th fit point you could give the following LISP command.

(command "_splinedit" (entsel) "f" "a" "4,1" "4.5,1.5" "" "" "x" "x")

 

Of course you can replace the explicit coordinates such as "4,1" with a LISP variable.

  • Thanks 1
Link to comment
Share on other sites

Thank you!

So, it is a set of coordinates either as comma separated text or a list.

 

In my test for some reason it would not accept the set coordinates I've been supplying even though it was correct coordinates of an existing fit point.

In fact, unless there is some kind rounding going on in the background and (print) doesn't show exactly the correct numbers, I've been seeing sometimes weird results when 2 identical real numbers would not match each other, for example, A and B are containing real numbers from (VLAX-CURVE-GETDISTATPOINT), when I print them, they seems to be the same numbers, however when comparing them with each other it returns unexpected:

A: 4.88763
B: 4.88763
(= A B): nil
(> A B): T
(< A B): nil

 

I also just realized that executing commands inside a command (in my case (getpoint) produces unexpected results, such as menu messages are shown.

Link to comment
Share on other sites

Coordinates are stored to approximately 15 significant digits.  When you print a number it is rounded to 6 significant digits.

 

Note that in the following a and b are shown as the same value when printed but they really differ by 0.0000001.

Command: (setq a 1.2345678)
1.23457
Command: (setq b 1.2345679)
1.23457
Command: (setq c (- a b))
-1.0e-07

 

  • Thanks 1
Link to comment
Share on other sites

1 hour ago, vanowm said:

they seems to be the same numbers, however when comparing them with each other it returns unexpected:

A: 4.88763
B: 4.88763
(= A B): nil
(> A B): T
(< A B): nil

 


When comparing reals use "equal" instead of "=", after two expressions you define fuzz factor. As was said above, CAD stores reals to max number of precision, so even though two numbers seem the same they might not be.

  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...