New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CadQuery Varibles Editor doesn't set variables #95
Comments
@robodan This may be more of a CadQuery/FreeCAD Module issue than a cqparts one. The variables in your second script are made up of objects rather than being simple int, float, string, etc variables. At this time, CQGI (which the Variables Editor in the FreeCAD module relies on) only understands simple variables. |
Oops, I included the wrong file. It should be this (which I can't seem to upload as a file). from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import cadquery
import cqparts
from cqparts.params import *
import logging
logging.basicConfig(level=logging.DEBUG)
config = "FFF" # 3D printing
scale = 1.0 # another config test
class MyPart(cqparts.Part):
width = PositiveFloat(5, doc="just that big")
length = PositiveFloat(5, doc="how far we'll go")
def make(self):
logging.info("config: %r scale: %f" % (config, scale))
obj = cadquery.Workplane('XY').circle(self.width / 2)
obj = obj.extrude(self.length)
return obj
if __name__ == '__main__':
mypart = MyPart()
mypart.exporter("stl")("example_part.stl")
else:
from cqparts.display import display
mypart = MyPart()
display(mypart) |
@robodan Can you wrap that in triple back ticks so that I can copy it? GitHub is trying to format it like markdown. |
Should be fixed now.
…On Thu, May 24, 2018 at 11:50 AM, Jeremy Wright ***@***.***> wrote:
@robodan <https://github.com/robodan> Can you wrap that in triple back
ticks so that I can copy it? GitHub is trying to format it like markdown.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#95 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA4ZVTLCUlwM1-etimpxHktLmN95dub6ks5t1wD_gaJpZM4UMvuQ>
.
|
Your first script uses the |
show_object of what? |
Sorry, you have to pull
|
@robodan yep, what @jmwright should work. I think to leverage the current g_width = 5
g_length = 5
mypart = MyPart(width=g_width, length=g_length)
show_object(mypart.local_obj)
from cqparts.utils import CoordSystem
mypart.world_coords = CoordSystem(origin=(0,20,0)) # (see note below)
show_object(mypart.world_obj) @jmwright is that note: requesting |
@fragmuffin Correct. The global variables will be accessible to CQGI, and passing them into MyPart serves the original intent. |
@robodan I'll close this issue with the above workaround. I've raised dcowden/cadquery#273 because this is not fixed, but the discussion needs to move to the right place. Thank you for the feedback @robodan ! |
In b2, a simple cadquery script can set the global variables through the CadQuery Variable Editor. This works fine for me in FreeCad.
b2.txt
[ edited: uploaded bm2.txt was the wrong file. See my reply below with correct cqpart code]
Ubuntu Linux 18.04 amd64
FreeCad 0.17
Cadquery 1.2.0 pip install
cqparts 0.2.0 pip install
The text was updated successfully, but these errors were encountered: