Change the Draft model points data. Where to locate the code

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
freecadlzh
Posts: 138
Joined: Fri Mar 06, 2020 12:52 pm

Change the Draft model points data. Where to locate the code

Post by freecadlzh »

I using the code below to create a Draft model:

Code: Select all

        TotalNumofPoint=numpy.size(PointsListX)
        listtmpPoints = []
        for i in range(TotalNumofPoint):
            listtmpPoints.append(FreeCAD.Vector(PointsListX[0][i],PointsListY[0][i],PointsListZ[0][i]))
        subline = Draft.makeWire(listtmpPoints,closed=False,face=False,support=None)
        mydistance = FreeCAD.Vector(1, 0, -1)
        Draft.move(subline , mydistance)
        Draft.autogroup(subline )
The prog runs will create a Draft model.In my data it will looks like a Arcs.

Now I selected the model and using the property panel,The property "Placement"\"Position"\"X"or"Y"or"Z" can change the Draft model place.
When I changed the model, I find the "End" property and the "Start" property will changed Automatically.

But by the python script "App.ActiveDocument.getObject("Wire001").Points[1]", I can find the points data in the Draft model "is not changed".
I have asked this question before. Some friends tell me to "Change the points data manually". I think it is a good way.

But my question is: Where can I write the code? I guess there is some event may be activated when I changed the Draft model's Placement property, but I do not know what name is the event,an where the event code is?

Need suggestion,Thanks a lot.
Post Reply