Search found 61 matches

Go to advanced search

by Chri1
Tue Nov 05, 2019 1:17 pm
Forum: Python scripting and macros
Topic: setPropertyByName
Replies: 3
Views: 148

setPropertyByName

Hi I created a python-object and added propérties (w1,w2,w3, w4) I managed to get the value of a property: … wi=["w1","w2","w3","w4"] # i generated by Code before val =bk.Object.getPropertyByName(winkel[i].Value) is there something equivalent to set the value of an property? Something like: val=50 b...
by Chri1
Sat Oct 19, 2019 2:59 pm
Forum: Python scripting and macros
Topic: origin of face of a prism, map rectangle to face
Replies: 3
Views: 462

Re: origin of face of a prism, map rectangle to face

I think I got it! Has nothing to do with the actual workplane obj: circle is already drawn #Before mapped: P0 = obj.Placement.Base ... #After mapped: mi=obj.Placement.toMatrix() mi=mi.inverse() P2=multVec(P0) obj.AttachmentOffset.Base.x=P2.x obj.AttachmentOffset.Base.y=P2.y mp = wp.getLocalCoords(mp...
by Chri1
Fri Oct 18, 2019 12:34 pm
Forum: Python scripting and macros
Topic: origin of face of a prism, map rectangle to face
Replies: 3
Views: 462

Re: origin of face of a prism, map rectangle to face

Ok, I also have to take care about rotation, but not now - first, I take a circle instead of rectangle. I dont' understand it!: The manual workflow would be: I draw a cube (10,10,10) in position(0,0,0) I select the face of the cube, which is parallel to yz and x = 10 and make it to current workingpl...
by Chri1
Tue Oct 15, 2019 8:14 am
Forum: Python scripting and macros
Topic: origin of face of a prism, map rectangle to face
Replies: 3
Views: 462

Re: origin of face of a prism, map rectangle to face

Ok, as I have thought so far, it does not work.
Will have to deal with coordinate system transformations...
by Chri1
Mon Oct 14, 2019 8:39 pm
Forum: Python scripting and macros
Topic: origin of face of a prism, map rectangle to face
Replies: 3
Views: 462

origin of face of a prism, map rectangle to face

Hi I have a prism, select one face of the prism, make the face to actual workingplane and draw a rectangle (-> obj) Now I map the rectangle to the face by code: .... bk = FreeCADGui.Selection.getSelectionEx()[0] #The selected face flae = bk.SubElementNames[0] ... P0 = obj.Placement.Base #The origin ...
by Chri1
Mon Oct 14, 2019 6:47 pm
Forum: Python scripting and macros
Topic: pause macro till other macro is finished
Replies: 5
Views: 506

Re: pause macro till other macro is finished

I found a dirty solution: Because my macro requires, that a face of a prism has to be selected, before it starts. When DraftTools.Rectangle().Activated() is finished, the new rectangle is selected and it has no subelements. -> I made an observer (addEventCallback "SoEvent"), which observes: ... sel ...
by Chri1
Sat Oct 12, 2019 12:14 pm
Forum: Python scripting and macros
Topic: addEventCallPivy - type of event
Replies: 5
Views: 468

Re: addEventCallPivy - type of event

Joel_graff wrote:
Fri Oct 11, 2019 9:41 am
Either one is fine.
I'll stay at addEventCallback()
Somehow it seems more handy for me ...

Incidentally, I just noticed that I forgot on "back" in my post (addEventCallback)

Thanks to all of you
by Chri1
Thu Oct 10, 2019 9:52 am
Forum: Python scripting and macros
Topic: addEventCallPivy - type of event
Replies: 5
Views: 468

addEventCallPivy - type of event

Hi I am able, to make an observer by using addEventCall. Apparently its better to use addEventCallPivy. Really, why? I made an "Soevent" and don't know, how to recognize, which event has happened: With addEventCall I used: if arg["Type"] == "SoKeyboardEvent": ..... But with addEventCallPivy? (The st...
by Chri1
Thu Oct 10, 2019 9:21 am
Forum: Python scripting and macros
Topic: pause macro till other macro is finished
Replies: 5
Views: 506

Re: pause macro till other macro is finished

Before I can use Draft.makeRectangle(), I would to have to take care about userinput by my own (Observer,...), Drafttools-Rectangle does this anyway. I could copy the code of Drafttools in an own macro and adjust it a little bit (insert a call to another function, after it's job is done) , but I'm r...
by Chri1
Wed Oct 09, 2019 6:38 pm
Forum: Python scripting and macros
Topic: pause macro till other macro is finished
Replies: 5
Views: 506

pause macro till other macro is finished

Hi In a macro I use DrafTools.Rectangle The problem is, that the code does not stop till rectangle is finished ... r=None r = DraftTools.Rectangle().Activated() ###Here it should wait, till rectangle is finished print("Rectangle finished") # This appears immediately before the rectangle exists ... s...

Go to advanced search