Search found 260 matches

by Aleks
Sat Jul 16, 2022 9:25 pm
Forum: Help on using FreeCAD
Topic: XHTML/X3D export does not work
Replies: 1
Views: 153

XHTML/X3D export does not work

I cannot export working xhtml/x3d files of my models anymore. I have tested it in FreeCAD 0.20 (29126) and 0.19 (24267 + 148).

The exported file just keeps on loading in the browser indefinetily.

Has someone else also witnessed this?
by Aleks
Sun May 15, 2022 1:51 pm
Forum: Python scripting and macros
Topic: Correct use of PropertyLinkSub - 'NoneType' object is not subscriptable
Replies: 2
Views: 276

Re: Correct use of PropertyLinkSub - 'NoneType' object is not subscriptable

Nevermind, I just passed the values to the custom obj class on object creation. class UselessBox(): def __init__(self, obj, sub_parent_obj, sub_elem_name): """ Default constructor """ self.Type = 'box' obj.Proxy = self obj.addProperty('App::PropertyString', 'Description...
by Aleks
Sun May 15, 2022 1:41 pm
Forum: Python scripting and macros
Topic: Correct use of PropertyLinkSub - 'NoneType' object is not subscriptable
Replies: 2
Views: 276

Re: Correct use of PropertyLinkSub - 'NoneType' object is not subscriptable

I suspect its because of this line, when the PropertyLinkSub gets assigned None. The LinkSub property gets assigned a real subobj shape later on.: obj.addProperty("App::PropertyLinkSub", "LinkSub", "Subsection", "Description for tooltip").LinkSub = None But I ...
by Aleks
Sun May 15, 2022 1:34 pm
Forum: Python scripting and macros
Topic: Correct use of PropertyLinkSub - 'NoneType' object is not subscriptable
Replies: 2
Views: 276

Correct use of PropertyLinkSub - 'NoneType' object is not subscriptable

I have created a FeaturePython object and attached a vertex subobj to it with PropertyLinkSub I get the following error at object creation, but not on object changes. 15:13:42 Traceback (most recent call last): File "C:/Users/Aleksander/AppData/Roaming/FreeCAD/Macro\uselessbox.py", line 27...
by Aleks
Sun May 15, 2022 11:39 am
Forum: Help on using FreeCAD
Topic: Python API Question
Replies: 15
Views: 1505

Re: Python API Question

The problem I had was probably caused because the Macro does not automatically reload upon change. I had other problems that also seemed random, but after understanding that I need to restart FreeCAD for Macro changes to take effect, I did not run into these issues anymore.
by Aleks
Mon May 02, 2022 4:48 pm
Forum: Python scripting and macros
Topic: Get vertex object from name in PropertyLinkSub
Replies: 4
Views: 567

Re: Get vertex object from name in PropertyLinkSub

TheMarkster wrote: Sat Apr 30, 2022 3:15 pm
Thank you, this worked for me. I made a small modification to directly return the first topo object and not a tuple of topo objects:

Code: Select all

vertex = obj.LinkSub[0].getSubObject(obj.LinkSub[1])[0]
by Aleks
Sat Apr 30, 2022 2:35 pm
Forum: Python scripting and macros
Topic: Get vertex object from name in PropertyLinkSub
Replies: 4
Views: 567

Re: Get vertex object from name in PropertyLinkSub

I need something like this:

Code: Select all

vertex = getVertex(<document_object>, <vertex_name>)
by Aleks
Sat Apr 30, 2022 2:33 pm
Forum: Help on using FreeCAD
Topic: Part_Sweep: cannot use SubLink edge for path
Replies: 10
Views: 1064

Re: Part_Sweep: cannot use SubLink edge for path

coming from:
https://forum.freecadweb.org/viewtopic.php?f=22&t=68398

Why does that even matter:

Code: Select all

sel_sub_idx = lnk.LinkedObject[1].index(sel_sub_name)
Isnt the index here totally different than the one in the shape?
by Aleks
Sat Apr 30, 2022 1:57 pm
Forum: Python scripting and macros
Topic: Get vertex object from name in PropertyLinkSub
Replies: 4
Views: 567

Get vertex object from name in PropertyLinkSub

I am linking to a vertex in a Part::FeaturePython object using PropertyLinkSub. Now I want to get the linked vertex in the execute method to move the box to the location of that linked vertex. obj.Shape = Part.makeBox(obj.Length, obj.Width, obj.Height) # something like this: # obj.Shape = Part.makeB...
by Aleks
Fri Apr 29, 2022 5:21 pm
Forum: Help on using FreeCAD
Topic: Python API Question
Replies: 15
Views: 1505

Re: Python API Question

I will investigate it and isolate the code bit by bit. I will post here once I have found the root cause.