Add a knot in Line using c++

Add a knot in Line using c++

287483179
Contributor Contributor
1,012 Views
12 Replies
Message 1 of 13

Add a knot in Line using c++

287483179
Contributor
Contributor

This is a very simple issue. In a certain scene, there is a "Line". Using C++ or C# methods, add a Knot to the line. Do not convert the Line into an EditableSpline. Do not use Maxscript.

I can't figure out what kind of shape Line is. It doesn't belong to any of the following types: simpleshape, simplespline, splineshape, Linearshape. Therefore, I need your help.

0 Likes
1,013 Views
12 Replies
Replies (12)
Message 2 of 13

istan
Advisor
Advisor

Before we start guessing, why you don't post a scene holding this "line" ?

PS: If you want me to take a look I need Max2024.

0 Likes
Message 3 of 13

287483179
Contributor
Contributor

I want to edit a line. If there is a line in the scene, you write a plugin to describe how to edit it.You know All Shape(simpleshape, simplespline, splineshape, Linearshape), we can be obtained their BezierShape, but "Line" cannot be obtained.

0 Likes
Message 4 of 13

istan
Advisor
Advisor
0 Likes
Message 5 of 13

287483179
Contributor
Contributor

I hope to develop the plugin in C++, rather than using MaxScript. In MaxScript, they are equivalent.

0 Likes
Message 6 of 13

istan
Advisor
Advisor

I'm sure this is also valid for C++. How did you find out, that it is not a Splineshape?

0 Likes
Message 7 of 13

287483179
Contributor
Contributor

Can you write a code example? Thank you very much!

0 Likes
Message 8 of 13

istan
Advisor
Advisor

You wrote that you have already found out, that it is not a SplineShape.. how did you come to the conclusion?

0 Likes
Message 9 of 13

287483179
Contributor
Contributor

If it is a SplineShape ,I'll get away with writing it this way without any error. However, the result is quite the opposite.

...

IShapeObject sobj = (IShapeObject)obj;

ISplineShape spl = (ISplineShape)sobj;

...

0 Likes
Message 10 of 13

istan
Advisor
Advisor

I thought you want to use C++ and SplineShape?

Why don't you then use a SplineShape?

Search for "SplineShape" in the samples.

0 Likes
Message 11 of 13

287483179
Contributor
Contributor

Because 'Line" can only be converted into IShapeObject, and there is no corresponding method in IShapeObject to edit "Line". We can only try to convert it into IBezierShape to have various methods to edit it. Could you directly edit a "Line" in C++/C#? If so, please write it out. Thank you.I have examined many examples in C++, and many methods assume that the object is *BezierShape. May I ask how Line can obtain *BezierShape? This is the core issue here.I have many questions. For instance, MaxScript can directly operate on Line objects. How is its underlying implementation achieved? Why is it that writing plugins in C++ is not as good as doing it in MaxScript? Logically speaking, it should be more flexible. Why is there such an incredible bug left behind?

0 Likes
Message 12 of 13

istan
Advisor
Advisor

I cannot find a single example in the maxsdk samples, which uses "IShapeObject" or "IBezierShape". So why you use them?

Again, search for "SplineShape" in the maxsdk samples, it finds e.g.: surfmod.cpp.

0 Likes
Message 13 of 13

287483179
Contributor
Contributor

In C#, it is IBezierShape, and in C++, it is BezierShape. There are numerous such examples where they are passed in as parameters with BezierShape as the parameter. Isn't there anyone using ShapeObject instead? Here is an example I wrote in C# for you. Please complete the task of deleting a Knot on Line. Everything is clear now, but why is no one aware of this?
...

IINode cNode = core.GetSelNode(0);
IObject obj = cNode.ObjectRef.FindBaseObject();
IShapeObject sobj = (IShapeObject)obj;
...
Please complete it.
...

Here is an example in C++, where the parameters are mostly of type BezierShape.

20250324224326.jpg

 

0 Likes