Home Technical Talk

Autodesk 3ds Max Maxscript: How to get the start and end point of a line segment?

polycounter lvl 6
Offline / Send Message
MrQuetch polycounter lvl 6
This question probably has a simple fix, and most likely doesn't even need it's own thread... But, the truth is, I can't find an answer for this type of question anywhere. I've noticed that I can get a position of a point in the Maxscript Help, but is there a way I can get the index of a point? If so, how can I reference the start and end points? The lines I'll be working with are only single segments, so no fancy curves.

Thanks for your help. My apologies about this thread.

Replies

  • Noors
    Offline / Send Message
    Noors greentooth
    You should look at "splineshape" in the maxscript help.
    You are probably looking for numKnots and getKnotPoint


  • MrQuetch
    Offline / Send Message
    MrQuetch polycounter lvl 6
    Noors said:
    You should look at "splineshape" in the maxscript help.
    You are probably looking for numKnots and getKnotPoint


    Hi, Noors.

    I'm well aware that those two functions exist. But, how can I get the index? Those only return how many knots there are, and the actual position of the points. I just want the index of the first and last point.
  • RN
    Offline / Send Message
    RN sublime tool
    MrQuetch said:
    I've noticed that I can get a position of a point in the Maxscript Help, but is there a way I can get the index of a point? If so, how can I reference the start and end points?
    You have the position of a unknown point of the segment. You have the index and position of all points in the segment (numknots and getKnotPoint). Go through all points in the segment and the one whose position is the same as what you have (or closest to, at least) will have the index you're interested in.

    If you use a For loop with some variable going from 1 to numKnots, the variable will point to the index you want when your input and getKnotPoint positions are equal. (I'm not sure if the indexes start at zero or 1, I'm thinking 1 in MaxScript).
  • MrQuetch
    Offline / Send Message
    MrQuetch polycounter lvl 6
    RN said:
    MrQuetch said:
    I've noticed that I can get a position of a point in the Maxscript Help, but is there a way I can get the index of a point? If so, how can I reference the start and end points?
    You have the position of an unknown point of the segment. You have the index and position of all points in the segment (numknots and getKnotPoint). Go through all points in the segment and the one whose position is the same as what you have (or closest to, at least) will have the index you're interested in.

    If you use a For loop with some variable going from 1 to numKnots, the variable will point to the index you want when your input and getKnotPoint positions are equal. (I'm not sure if the indexes start at zero or 1, I'm thinking 1 in MaxScript).
    Hi again, RN.

    Thank you for the explanation of those functions. I did not realize that they could be used in that way. I really appreciate it. Thank you.
Sign In or Register to comment.