Porównaj commity

...

66 Commity

Autor SHA1 Wiadomość Data
Alain Pelletier 40a46d4156
Merge pull request #248 from pppalain/master
August 2023 update
2023-08-01 14:12:12 -03:00
Alain Pelletier acf5300bcf
Merge pull request #247 from Kosovircek/hotfix-for-shapely
Hotfix for: No module named 'shapely' issue #232
2023-08-01 14:09:15 -03:00
Alain Pelletier 064bea981c
Merge pull request #246 from smathermather/opencamlib_patch
Remove broken opencamlib link
2023-08-01 14:08:29 -03:00
palain b448c5c70a outline fill now works for inside as well as outside. 2023-07-30 11:38:24 -03:00
palain 62dbfb937a added oval to sign plate 2023-07-29 19:56:49 -03:00
palain b8e19b09ec added cove and bevel corners to sign plate 2023-07-24 14:32:39 -03:00
Kosovircek a5b2e5a890 Hotfix for: No module named 'shapely' 2023-07-21 12:49:06 +02:00
Alain Pelletier 82a395825e
Merge pull request #113 from migo1001/master
Moved options to optimisation panel
2023-07-14 20:30:53 -03:00
migo101 e9b8cbbdf7 Move options to optimisation panel 2023-07-14 18:41:31 +02:00
palain 6762e58680 fixed typo bug 2023-07-12 14:57:17 -03:00
Alain Pelletier 055ca024e0
Merge pull request #112 from migo1001/master
Bugfix
2023-07-12 11:35:20 -03:00
migo1001 a37b4fb422
Merge branch 'pppalain:master' into master 2023-07-12 15:45:41 +02:00
migo101 e3186961ff Bugfix 2023-07-12 15:45:22 +02:00
Alain Pelletier 03c8153d89
Merge pull request #111 from migo1001/master
Recovered warning
2023-07-12 09:58:27 -03:00
migo1001 c0eb525cc5
Merge branch 'pppalain:master' into master 2023-07-12 11:43:50 +02:00
migo101 de7607c9e7 Recovered warning about maxz > free_height 2023-07-12 11:42:34 +02:00
Alain Pelletier 29dc7605c1
Merge pull request #110 from migo1001/master
Reverting to previous version
2023-07-10 15:00:33 -03:00
migo101 d8785a7700 Reverted to commit 048f992ced 2023-07-10 19:56:24 +02:00
migo101 1198608543 Revert "Merge remote-tracking branch 'origin/master'"
This reverts commit 048f992ced, reversing
changes made to b827807396.
2023-07-10 19:52:11 +02:00
migo101 2d5916ca79 Revert "Merge remote-tracking branch 'origin/master'"
This reverts commit 048f992ced, reversing
changes made to 2541d64935.
2023-07-10 19:50:33 +02:00
Alain Pelletier 35d841037c
Merge pull request #109 from migo1001/master
Moved area properties to ui_panels/
2023-07-10 12:15:06 -03:00
Stephen Mather 7b91aa8c22
Remove broken opencamlib link 2023-07-09 12:29:50 -04:00
migo101 e07db60af9 Moved area properties to ui_panels/ 2023-07-09 17:05:19 +02:00
palain 048f992ced Merge remote-tracking branch 'origin/master' 2023-07-07 11:31:42 -03:00
palain 2541d64935 fixed A B rotation indexing. Rotation did not refresh 2023-07-07 11:31:35 -03:00
Alain Pelletier b827807396
Delete scripts/addons/cam/bpypolyskel directory 2023-07-07 10:37:54 -03:00
Alain Pelletier ae4747edf6
Merge pull request #108 from migo1001/master
Cleaned up tests and added procedure
2023-07-07 08:50:38 -03:00
migo101 1287578fc7 Cleanup 2023-07-07 13:12:32 +02:00
migo101 c33d410e61 Cleanup 2023-07-07 13:11:07 +02:00
migo101 752580e803 Cleanup 2023-07-07 13:09:25 +02:00
migo101 d5a1921644 Support tap files 2023-07-07 13:06:43 +02:00
migo101 04ff18472d Missing a cd 2023-07-07 13:04:20 +02:00
migo101 135559cb4e Added procedure 2023-07-07 12:58:26 +02:00
migo101 9e93f95a54 Cleanup 2023-07-07 12:33:26 +02:00
migo101 d33830be7e Cleanup 2023-07-07 11:56:36 +02:00
migo101 8334af83d3 Cleanup 2023-07-07 11:30:32 +02:00
Alain Pelletier d71cf333b5
Merge pull request #107 from migo1001/master
Added Experimental level for interface
2023-07-06 12:56:38 -03:00
migo1001 5677ca9152
Merge branch 'pppalain:master' into master 2023-07-06 17:54:43 +02:00
migo101 660b309f51 Added experimental level 2023-07-06 17:54:07 +02:00
Alain Pelletier 429570f755
Merge pull request #106 from migo1001/master
Large Update: Implemented UI level display
2023-07-06 12:31:54 -03:00
migo101 6140a50969 Added test suite 2023-07-06 17:30:22 +02:00
migo101 8bf512afc3 Added strategies to levels 2023-07-05 16:23:56 +02:00
migo101 e828a138f4 Remodeled display calculation, converted operations, working on op_properties 2023-07-04 19:16:13 +02:00
migo1001 b4643389e0
Merge branch 'pppalain:master' into master 2023-07-04 18:44:25 +02:00
palain cf00ddd4f7 added cut distance in console text message 2023-06-29 13:50:58 -03:00
palain 21609c31c8 fix split file end program M02 2023-06-27 14:29:55 -03:00
palain 8e0a29a897 Merge remote-tracking branch 'origin/master' 2023-06-26 10:21:34 -03:00
palain 6eb651dc53 fix experimental trailer 2023-06-26 10:21:27 -03:00
migo101 e8ab125e15 Added levels for gcode 2023-06-21 18:45:50 +02:00
migo1001 0cc0e7c9b5
Merge branch 'pppalain:master' into master 2023-06-21 18:13:26 +02:00
migo101 776ae20bc6 Added levels for feedrate 2023-06-20 11:38:22 +02:00
migo101 4da8467760 feedrate.py 2023-06-19 17:03:06 +02:00
migo101 d026f671b7 Added levels to cutter 2023-06-19 16:07:57 +02:00
migo1001 3ecca5192c
Merge branch 'pppalain:master' into master 2023-06-18 14:12:55 +02:00
migo101 9a92deaab0 Add levels to op area 2023-06-18 13:06:39 +02:00
migo1001 337914ccfc
Merge branch 'pppalain:master' into master 2023-06-16 16:04:54 +02:00
migo101 dde8bcb737 Temp commit for area 2023-06-16 15:27:05 +02:00
migo101 d0baa8d264 Info has levels 2023-06-16 12:38:21 +02:00
migo101 1078ab8af7 Added levels to material 2023-06-16 12:29:21 +02:00
migo101 a95ccbec0c Implemented prop levels 2023-06-15 18:42:00 +02:00
migo101 c09e5062be Changed levels for gcode, info 2023-06-14 11:33:08 +02:00
migo101 a23559f63a Movement is level 0 2023-06-13 20:43:58 +02:00
migo1001 a308cd25e9
Merge branch 'pppalain:master' into master 2023-06-13 20:31:32 +02:00
migo101 e749a7b6e6 Added levels for all panels 2023-06-13 20:15:22 +02:00
migo101 e3a7a401a0 Implemented Interface Level 2023-06-13 19:51:15 +02:00
migo101 e72639c0bd Added interface selector 2023-06-12 20:17:39 +02:00
36 zmienionych plików z 6551 dodań i 1344 usunięć

Wyświetl plik

@ -25,7 +25,7 @@ Setup machine parameters (postprocessor, maximum feed rate, work area, etc.) in
Add new operation in the render properties.
![New operation](images/newop.png)
Choose Parallel (or Outline Fill, Circles, Spiral, Block, Cross) in the Strategy dialog. Waterline option works best when [OpenCAMLib](Opencamlib%20Installation.md) is installed and other operations require curve data source. See how to generate curves from mesh model [here](Profile%20and%20Pocket%20operations.md).
Choose Parallel (or Outline Fill, Circles, Spiral, Block, Cross) in the Strategy dialog. Waterline option works best when OpenCAMLib is installed and other operations require curve data source. See how to generate curves from mesh model [here](Profile%20and%20Pocket%20operations.md).
![Select operation](images/selectOperation.png)

Wyświetl plik

@ -51,6 +51,8 @@ from shapely import geometry as sgeometry
from cam.ui import *
bl_info = {
"name": "CAM - gcode generation tools",
"author": "Vilem Novak",
@ -67,7 +69,6 @@ import cam.constants
was_hidden_dict = {}
def updateMachine(self, context):
print('update machine ')
utils.addMachineAreaObject()
@ -404,6 +405,7 @@ def updateBridges(o, context):
def updateRotation(o, context):
print('update rotation')
if o.enable_B or o.enable_A:
print(o, o.rotation_A)
ob = bpy.data.objects[o.object_name]
@ -471,7 +473,6 @@ class camOperation(bpy.types.PropertyGroup):
optimisation: bpy.props.PointerProperty(type=CAM_OPTIMISATION_Properties)
movement: bpy.props.PointerProperty(type=CAM_MOVEMENT_Properties)
name: bpy.props.StringProperty(name="Operation Name", default="Operation", update=updateRest)
filename: bpy.props.StringProperty(name="File name", default="Operation", update=updateRest)
auto_export: bpy.props.BoolProperty(name="Auto export",
@ -669,16 +670,16 @@ class camOperation(bpy.types.PropertyGroup):
rotation_A: bpy.props.FloatProperty(name="A axis angle", description="Rotate A axis\nto specified angle", default=0,
min=-360, max=360, precision=0,
subtype="ANGLE", unit="ROTATION", update=updateRest)
subtype="ANGLE", unit="ROTATION", update=updateRotation)
enable_A: bpy.props.BoolProperty(name="Enable A axis", description="Rotate A axis", default=False,
update=updateRest)
update=updateRotation)
A_along_x: bpy.props.BoolProperty(name="A Along X ", description="A Parallel to X", default=True, update=updateRest)
rotation_B: bpy.props.FloatProperty(name="B axis angle", description="Rotate B axis\nto specified angle", default=0,
min=-360, max=360, precision=0,
subtype="ANGLE", unit="ROTATION", update=updateRest)
subtype="ANGLE", unit="ROTATION", update=updateRotation)
enable_B: bpy.props.BoolProperty(name="Enable B axis", description="Rotate B axis", default=False,
update=updateRest)
update=updateRotation)
# carve only
carve_depth: bpy.props.FloatProperty(name="Carve depth", default=0.001, min=-.100, max=32, precision=cam.constants.PRECISION,
@ -1131,6 +1132,7 @@ def get_panels(): # convenience function for bot register and unregister functi
machineSettings,
CamAddonPreferences,
ui.CAM_INTERFACE_Panel,
ui.CAM_CHAINS_Panel,
ui.CAM_OPERATIONS_Panel,
ui.CAM_INFO_Panel,
@ -1333,6 +1335,8 @@ classes = [
CamAddonPreferences,
import_settings,
ui.CAM_INTERFACE_Panel,
ui.CAM_INTERFACE_Properties,
ui.CAM_CHAINS_Panel,
ui.CAM_OPERATIONS_Panel,
ui.CAM_INFO_Properties,
@ -1452,6 +1456,7 @@ def register():
s.cam_slice = bpy.props.PointerProperty(type=SliceObjectsSettings)
bpy.types.Scene.interface = bpy.props.PointerProperty(type=CAM_INTERFACE_Properties)
def unregister():
for p in classes:

Wyświetl plik

@ -1,675 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

Wyświetl plik

@ -1,51 +0,0 @@
# bpypolyskel
![Logo](./misc/logo.jpg)
How to fit a hipped roof to the walls of a building? No problem, the _bpypolyskel_ library provides a single function that does the whole task automatically. From the footprint of a building, its [_straight skeleton_](https://en.wikipedia.org/wiki/Straight_skeleton) gets computed. From this skeleton all _faces_ get extracted and the height for every vertex of the straight skeleton is calculated. All these computations can easily be done in [Blender](https://www.blender.org/), but the library may also be used in general purpose applications.
The _bpypolyskel_ library was [tested](https://github.com/prochitecture/bpypolyskel/wiki/Testing) against all 320.000 hipped roofs in the OpenStreetMap database. It runs successfully for 99.99% of them.
## Usage
The library _bpypolyskel_ provides two functions:
- `polygonize()`
_polygonize()_ is the main function to compute the faces of a hipped roof from the footprint of a building, it does the whole task described above. It accepts a simple description of the contour of the footprint polygon, including those of eventual holes, and returns a list of polygon faces. See more details in its [documentation](https://github.com/prochitecture/bpypolyskel/wiki/polygonize).
- `skeletonize()`
_skeletonize()_ creates the [straight skeleton](https://en.wikipedia.org/wiki/Straight_skeleton) of the footprint. It gets a list of the edges of the footprint polygon, including those of eventual holes, and creates a straight skeleton. This function is called from _polygonize()_, but may also be used independently. See more details in its [documentation](https://github.com/prochitecture/bpypolyskel/wiki/skeletonize)
### Note
The straight skeleton computed by _skeletonize()_ does not provide a straight skeleton in a mathematical sense. Several cleaning and merging algorithms repair issues produced by inaccuracies of the footprint and issues in the skeletonize algorithm. Its goal is to create a skeleton that fits best for a hipped roof.
## Installation and Demos
You find all required files in the folder [bpypolyskel](./bpypolyskel). There are two main applications of this project:
### Within a Blender addon
Copy the whole folder [bpypolyskel](./bpypolyskel) to your addon. Include the functions using
```
from .bpypolyskel import bpypolyskel
```
The file [__init__.py](./__init__.py) shows a simple code for usage in an addon. It adds an object created by _bpypolyskel_ to a scene. The demo object is created in Blender by Add -> Mesh -> Add bpypolyskel Demo Object.
### General purpose application
The functions of _bpypolyskel_ are also usable using a Python interpreter, but then the installation of the package _mathutils_ is required. Install it using:
```
pip install mathutils
```
A simple demo in the file [demo.py](./demo.py) shows this type of usage and displays the result using `matplotlib`.
## Credits
The implementation of the straight skeleton algorithm is based on the description by Felkel and Obdržálek in their 1998 conference paper
[Straight skeleton implementation](http://www.dma.fi.upm.es/personal/mabellanas/tfcs/skeleton/html/documentacion/Straight%20Skeletons%20Implementation.pdf). The code for the function _skeletonize()_ has been ported from the implementation by [Botffy](https://github.com/Botffy/polyskel).
The main adaptations compared to Botffy's original code are:
- The order of the vertices of the polygon has been changed to a right-handed coordinate system (as used in Blender). The positive x and y axes point right and up, and the z axis points into your face. Positive rotation is counterclockwise around the z-axis.
- The geometry objects used from the library `euclid3` in the implementation of Bottfy have been replaced by objects based on `mathutils.Vector`. These objects are defined in the new library [bpyeuclid](./bpypolyskel/bpyeuclid.py).
- The signature of `skeletonize()` has been changed to lists of edges for the polygon and eventual hole. These are of type `Edge2`, defined in [bpyeuclid](./bpypolyskel/bpyeuclid.py).
- Some parts of the skeleton computations have been changed to fix errors produced by the original implementation.
- Algorithms to merge clusters of skeleton nodes and to filter ghost edges have been added.
- A pattern matching algorithm to detect apses, that creates a multi-edge event to create a proper apse skeleton.

Wyświetl plik

@ -168,6 +168,28 @@ class CamCurvePlate(bpy.types.Operator):
unit="LENGTH")
hole_hamount: bpy.props.IntProperty(name="Hole horiz amount", default=1, min=0, max=50)
resolution: bpy.props.IntProperty(name="Spline resolution", default=50, min=3, max=150)
plate_type: EnumProperty(name='Type plate',
items=(('ROUNDED', 'Rounded corner', 'Makes a rounded corner plate'),
('COVE', 'Cove corner', 'Makes a plate with circles cut in each corner '),
('BEVEL', 'Bevel corner', 'Makes a plate with beveled corners '),
('OVAL', 'Elipse', 'Makes an oval plate')),
description='Type of Plate', default='ROUNDED')
def draw(self, context):
layout = self.layout
layout.prop(self, 'plate_type')
layout.prop(self, 'width')
layout.prop(self, 'height')
layout.prop(self, 'hole_diameter')
layout.prop(self, 'hole_tolerance')
layout.prop(self, 'hole_vdist')
layout.prop(self, 'hole_hdist')
layout.prop(self, 'hole_hamount')
layout.prop(self, 'resolution')
if self.plate_type in ["ROUNDED", "COVE", "BEVEL"]:
layout.prop(self, 'radius')
def execute(self, context):
left = -self.width / 2 + self.radius
@ -175,39 +197,115 @@ class CamCurvePlate(bpy.types.Operator):
right = -left
top = -bottom
if self.plate_type == "ROUNDED":
# create base
bpy.ops.curve.primitive_bezier_circle_add(radius=self.radius, enter_editmode=False, align='WORLD',
bpy.ops.curve.primitive_bezier_circle_add(radius=self.radius, enter_editmode=False, align='WORLD',
location=(left, bottom, 0), scale=(1, 1, 1))
simple.active_name("_circ_LB")
bpy.context.object.data.resolution_u = self.resolution
bpy.ops.curve.primitive_bezier_circle_add(radius=self.radius, enter_editmode=False, align='WORLD',
simple.active_name("_circ_LB")
bpy.context.object.data.resolution_u = self.resolution
bpy.ops.curve.primitive_bezier_circle_add(radius=self.radius, enter_editmode=False, align='WORLD',
location=(right, bottom, 0), scale=(1, 1, 1))
simple.active_name("_circ_RB")
bpy.context.object.data.resolution_u = self.resolution
bpy.ops.curve.primitive_bezier_circle_add(radius=self.radius, enter_editmode=False, align='WORLD',
simple.active_name("_circ_RB")
bpy.context.object.data.resolution_u = self.resolution
bpy.ops.curve.primitive_bezier_circle_add(radius=self.radius, enter_editmode=False, align='WORLD',
location=(left, top, 0), scale=(1, 1, 1))
simple.active_name("_circ_LT")
bpy.context.object.data.resolution_u = self.resolution
bpy.ops.curve.primitive_bezier_circle_add(radius=self.radius, enter_editmode=False, align='WORLD',
simple.active_name("_circ_LT")
bpy.context.object.data.resolution_u = self.resolution
bpy.ops.curve.primitive_bezier_circle_add(radius=self.radius, enter_editmode=False, align='WORLD',
location=(right, top, 0), scale=(1, 1, 1))
simple.active_name("_circ_RT")
bpy.context.object.data.resolution_u = self.resolution
simple.active_name("_circ_RT")
bpy.context.object.data.resolution_u = self.resolution
simple.select_multiple("_circ") # select the circles for the four corners
utils.polygonConvexHull(context) # perform hull operation on the four corner circles
simple.active_name("plate_base")
simple.remove_multiple("_circ") # remove corner circles
elif self.plate_type == "OVAL":
bpy.ops.curve.simple(align='WORLD', location=(0, 0, 0), rotation=(0, 0, 0), Simple_Type='Ellipse',
Simple_a=self.width/2,Simple_b=self.height/2, use_cyclic_u=True, edit_mode=False)
bpy.context.object.data.resolution_u = self.resolution
simple.active_name("plate_base")
elif self.plate_type == 'COVE':
bpy.ops.curve.primitive_bezier_circle_add(radius=self.radius, enter_editmode=False, align='WORLD',
location=(left-self.radius, bottom-self.radius, 0), scale=(1, 1, 1))
simple.active_name("_circ_LB")
bpy.context.object.data.resolution_u = self.resolution
bpy.ops.curve.primitive_bezier_circle_add(radius=self.radius, enter_editmode=False, align='WORLD',
location=(right+self.radius, bottom-self.radius, 0), scale=(1, 1, 1))
simple.active_name("_circ_RB")
bpy.context.object.data.resolution_u = self.resolution
bpy.ops.curve.primitive_bezier_circle_add(radius=self.radius, enter_editmode=False, align='WORLD',
location=(left-self.radius, top+self.radius, 0), scale=(1, 1, 1))
simple.active_name("_circ_LT")
bpy.context.object.data.resolution_u = self.resolution
bpy.ops.curve.primitive_bezier_circle_add(radius=self.radius, enter_editmode=False, align='WORLD',
location=(right+self.radius, top+self.radius, 0), scale=(1, 1, 1))
simple.active_name("_circ_RT")
bpy.context.object.data.resolution_u = self.resolution
simple.join_multiple("_circ")
bpy.ops.curve.simple(align='WORLD', Simple_Type='Rectangle',
Simple_width=self.width, Simple_length=self.height, outputType='POLY', use_cyclic_u=True,
edit_mode=False)
simple.active_name("_base")
simple.difference("_","_base")
simple.rename("_base","plate_base")
elif self.plate_type == 'BEVEL':
bpy.ops.curve.simple(align='WORLD', Simple_Type='Rectangle',
Simple_width=self.radius*2, Simple_length=self.radius*2, location=(left-self.radius, bottom-self.radius, 0),
rotation=(0, 0, 0.785398),outputType='POLY', use_cyclic_u=True, edit_mode=False)
simple.active_name("_bev_LB")
bpy.context.object.data.resolution_u = self.resolution
bpy.ops.curve.simple(align='WORLD', Simple_Type='Rectangle',
Simple_width=self.radius*2, Simple_length=self.radius*2,
location=(right+self.radius, bottom-self.radius, 0),
rotation=(0, 0, 0.785398),outputType='POLY', use_cyclic_u=True, edit_mode=False)
simple.active_name("_bev_RB")
bpy.context.object.data.resolution_u = self.resolution
bpy.ops.curve.simple(align='WORLD', Simple_Type='Rectangle',
Simple_width=self.radius*2, Simple_length=self.radius*2,
location=(left-self.radius, top+self.radius, 0),
rotation=(0, 0, 0.785398),outputType='POLY', use_cyclic_u=True, edit_mode=False)
simple.active_name("_bev_LT")
bpy.context.object.data.resolution_u = self.resolution
bpy.ops.curve.simple(align='WORLD', Simple_Type='Rectangle',
Simple_width=self.radius*2, Simple_length=self.radius*2,
location=(right+self.radius, top+self.radius, 0),
rotation=(0, 0, 0.785398),outputType='POLY', use_cyclic_u=True, edit_mode=False)
simple.active_name("_bev_RT")
bpy.context.object.data.resolution_u = self.resolution
simple.join_multiple("_bev")
bpy.ops.curve.simple(align='WORLD', Simple_Type='Rectangle',
Simple_width=self.width, Simple_length=self.height, outputType='POLY', use_cyclic_u=True,
edit_mode=False)
simple.active_name("_base")
simple.difference("_","_base")
simple.rename("_base","plate_base")
simple.select_multiple("_circ") # select the circles for the four corners
utils.polygonConvexHull(context) # perform hull operation on the four corner circles
simple.active_name("plate_base")
simple.remove_multiple("_circ") # remove corner circles
if self.hole_diameter > 0 or self.hole_hamount > 0:
bpy.ops.curve.primitive_bezier_circle_add(radius=self.hole_diameter / 2, enter_editmode=False,
align='WORLD', location=(0, self.hole_tolerance / 2, 0),
scale=(1, 1, 1))
align='WORLD', location=(0, self.hole_tolerance / 2, 0),
scale=(1, 1, 1))
simple.active_name("_hole_Top")
bpy.context.object.data.resolution_u = int(self.resolution / 4)
if self.hole_tolerance > 0:
bpy.ops.curve.primitive_bezier_circle_add(radius=self.hole_diameter / 2, enter_editmode=False,
align='WORLD', location=(0, -self.hole_tolerance / 2, 0),
scale=(1, 1, 1))
align='WORLD', location=(0, -self.hole_tolerance / 2, 0),
scale=(1, 1, 1))
simple.active_name("_hole_Bottom")
bpy.context.object.data.resolution_u = int(self.resolution / 4)
@ -221,7 +319,7 @@ class CamCurvePlate(bpy.types.Operator):
simple.join_multiple("plate_hole") # join the holes together
# horizontal holes
# horizontal holes
if self.hole_hamount > 1:
if self.hole_hamount % 2 != 0:
for x in range(int((self.hole_hamount - 1) / 2)):

Wyświetl plik

@ -658,7 +658,9 @@ class CamObjectSilhouete(bpy.types.Operator):
def poll(cls, context):
# return context.active_object is not None and (context.active_object.type == 'CURVE'
# or context.active_object.type == 'FONT' or context.active_object.type == 'MESH')
return context.active_object is not None and (context.active_object.type == 'MESH')
return context.active_object is not None and (
context.active_object.type == 'FONT' or
context.active_object.type == 'MESH')
def execute(self, context): # this is almost same as getobjectoutline, just without the need of operation data
ob = bpy.context.active_object

Wyświetl plik

@ -196,7 +196,7 @@ def exportGcodePath(filename, vertslist, operations):
processedops = 0
last = Vector((0, 0, 0))
cut_distance = 0
for i, o in enumerate(operations):
if use_experimental and o.output_header:
@ -448,7 +448,7 @@ def exportGcodePath(filename, vertslist, operations):
c.feed(x=vx, y=vy, z=vz)
else:
c.feed(x=vx, y=vy, z=vz, a=ra, b=rb)
cut_distance+=vect.length * unitcorr
vector_duration = vect.length / f
duration += vector_duration
last = v
@ -459,6 +459,7 @@ def exportGcodePath(filename, vertslist, operations):
if split and processedops > m.split_limit:
c.rapid(x=last.x * unitcorr, y=last.y * unitcorr, z=free_height * unitcorr)
# @v=(ch.points[-1][0],ch.points[-1][1],free_height)
c.program_end()
findex += 1
c.file_close()
c = startNewFile()
@ -484,13 +485,21 @@ def exportGcodePath(filename, vertslist, operations):
round(online / (offline + online) * 100, 1)) + "% removal")
c.feedrate(unitcorr * o.feedrate)
if use_experimental and o.output_trailer:
if o.output_trailer:
lines = o.gcode_trailer.split(';')
for aline in lines:
c.write(aline + '\n')
o.info.duration = duration * unitcorr
print("total time:",round(o.info.duration * 60),"seconds")
if bpy.context.scene.unit_settings.system == 'METRIC':
unit_distance = 'm'
cut_distance /= 1000
else:
unit_distance = 'feet'
cut_distance /= 12
print("cut distance:", round(cut_distance,3), unit_distance)
if enable_dust:
c.write(stop_dust + '\n')
if enable_hold:

Wyświetl plik

@ -19,6 +19,9 @@
#
# ***** END GPL LICENCE BLOCK *****
# Solves: No module named 'shapely' (even if it is installed)
help('modules')
import math
import sys
import os

Wyświetl plik

@ -101,7 +101,10 @@ def cutout(o):
if o.outlines_count > 1:
for i in range(1, o.outlines_count):
chunksFromCurve.extend(shapelyToChunks(p, -1))
p = p.buffer(distance=o.dist_between_paths * offset, resolution=o.optimisation.circle_detail, join_style=join,
path_distance = o.dist_between_paths
if o.cut_type == "INSIDE":
path_distance *= -1
p = p.buffer(distance = path_distance, resolution=o.optimisation.circle_detail, join_style=join,
mitre_limit=2)
chunksFromCurve.extend(shapelyToChunks(p, -1))

Wyświetl plik

@ -0,0 +1,30 @@
1. Running the tests
> python test-suite.py
The script will go through each blend file, generate GCode for all operations and compare the results with the reference.
2. Creating new tests
> cd test_data
> mkdir name_of_your_test
> cd name_of_your_test
> blender name_of_your_blend_file (can be the same name as the subdirectory)
- Create as many operations as necessary using BlenderCAM. Do not add operations that need a
long calculation time unless absolutely necessary, as they will be executed everytime the
tests are run.
- Generate the corresponding GCode with "Calculate Path and export GCode" for every operation.
-Rename the generated files by adding an underscore at the beginning. This will make them
become the reference result files.
> mv Op1.gcode _Op1.gcode
- Save the blender file
- Commit and push

Wyświetl plik

@ -0,0 +1,14 @@
import bpy
# Get the scene
s = bpy.context.scene
for i, operation in enumerate(s.cam_operations):
# Set the active operation using the index
s.cam_active_operation = i
print(f"############ Generating {operation.name} #############")
# Run the calculate_cam_path() operator
bpy.ops.object.calculate_cam_path()

Wyświetl plik

@ -0,0 +1,370 @@
(Created with grbl post processor 2023/07/06 16:58)
G21
(G-code generated with BlenderCAM and NC library)
G17G90
(Tool: D = 3.0 mm type END flutes 2)
S12000M03
G00 Z10.0
G0X0Y0Z10
X-66Y-18
G1Z-5.1F500
Y17.999F1000
G0Z10
X-63Y-26.5
G1Z-5.1F500
Y26.499F1000
G0Z10
X-60Y-33
G1Z-5.1F500
Y32.999F1000
G0Z10
X-57Y-37.5
G1Z-5.1F500
Y37.499F1000
G0Z10
X-54Y-42
G1Z-5.1F500
Y41.999F1000
G0Z10
X-51Y-45.5
G1Z-5.1F500
Y45.499F1000
G0Z10
X-48Y-48.5
G1Z-5.1F500
Y48.499F1000
G0Z10
X-45Y-51.5
G1Z-5.1F500
Y51.499F1000
G0Z10
X-42Y-54
G1Z-5.1F500
Y53.999F1000
G0Z10
X-39Y-56
G1Z-5.1F500
Y55.999F1000
G0Z10
X-36Y-58
G1Z-5.1F500
Y57.999F1000
G0Z10
X-33Y-60
G1Z-5.1F500
Y59.999F1000
G0Z10
X-30Y-61.5
G1Z-5.1F500
Y61.499F1000
G0Z10
X-27Y-62.5
G1Z-5.1F500
Y62.499F1000
G0Z10
X-24Y-64
G1Z-5.1F500
Y63.999F1000
G0Z10
X-21Y-65
G1Z-5.1F500
Y64.999F1000
G0Z10
X-18Y-66
G1Z-5.1F500
Y65.999F1000
G0Z10
X-15Y-66.5
G1Z-5.1F500
Y66.499F1000
G0Z10
X-12Y-67
G1Z-5.1F500
Y66.999F1000
G0Z10
X-9Y-67.5
G1Z-5.1F500
Y67.499F1000
G0Z10
X-6Y-68
G1Z-5.1F500
Y67.999F1000
G0Z10
X-3Y-68
G1Z-5.1F500
Y67.999F1000
G0Z10
X0Y-68
G1Z-5.1F500
Y68.499F1000
G0Z10
X3Y-68
G1Z-5.1F500
Y67.999F1000
G0Z10
X6Y-68
G1Z-5.1F500
Y67.999F1000
G0Z10
X9Y-67.5
G1Z-5.1F500
Y67.499F1000
G0Z10
X12Y-67
G1Z-5.1F500
Y66.999F1000
G0Z10
X15Y-66.5
G1Z-5.1F500
Y66.499F1000
G0Z10
X18Y-66
G1Z-5.1F500
Y65.999F1000
G0Z10
X21Y-65
G1Z-5.1F500
Y64.999F1000
G0Z10
X24Y-64
G1Z-5.1F500
Y63.999F1000
G0Z10
X27Y-62.5
G1Z-5.1F500
Y62.499F1000
G0Z10
X30Y-61.5
G1Z-5.1F500
Y61.499F1000
G0Z10
X33Y-60
G1Z-5.1F500
Y59.999F1000
G0Z10
X36Y-58
G1Z-5.1F500
Y57.999F1000
G0Z10
X39Y-56
G1Z-5.1F500
Y55.999F1000
G0Z10
X42Y-54
G1Z-5.1F500
Y53.999F1000
G0Z10
X45Y-51.5
G1Z-5.1F500
Y51.499F1000
G0Z10
X48Y-48.5
G1Z-5.1F500
Y48.499F1000
G0Z10
X51Y-45.5
G1Z-5.1F500
Y45.499F1000
G0Z10
X54Y-42
G1Z-5.1F500
Y41.999F1000
G0Z10
X57Y-37.5
G1Z-5.1F500
Y37.499F1000
G0Z10
X60Y-33
G1Z-5.1F500
Y32.999F1000
G0Z10
X63Y-26.5
G1Z-5.1F500
Y26.499F1000
G0Z10
X66Y-18
G1Z-5.1F500
Y17.999F1000
G0Z10
X-66Y-18
G1Z-6.912F500
Y17.999F1000
G0Z10
X-63Y-26.5
G1Z-6.912F500
Y26.499F1000
G0Z10
X-60Y-33
G1Z-6.912F500
Y32.999F1000
G0Z10
X-57Y-37.5
G1Z-6.912F500
Y37.499F1000
G0Z10
X-54Y-42
G1Z-6.912F500
Y41.999F1000
G0Z10
X-51Y-45.5
G1Z-6.912F500
Y45.499F1000
G0Z10
X-48Y-48.5
G1Z-6.912F500
Y48.499F1000
G0Z10
X-45Y-51.5
G1Z-6.912F500
Y51.499F1000
G0Z10
X-42Y-54
G1Z-6.912F500
Y53.999F1000
G0Z10
X-39Y-56
G1Z-6.912F500
Y55.999F1000
G0Z10
X-36Y-58
G1Z-6.912F500
Y57.999F1000
G0Z10
X-33Y-60
G1Z-6.912F500
Y59.999F1000
G0Z10
X-30Y-61.5
G1Z-6.912F500
Y61.499F1000
G0Z10
X-27Y-62.5
G1Z-6.912F500
Y62.499F1000
G0Z10
X-24Y-64
G1Z-6.912F500
Y63.999F1000
G0Z10
X-21Y-65
G1Z-6.912F500
Y64.999F1000
G0Z10
X-18Y-66
G1Z-6.912F500
Y65.999F1000
G0Z10
X-15Y-66.5
G1Z-6.912F500
Y66.499F1000
G0Z10
X-12Y-67
G1Z-6.912F500
Y66.999F1000
G0Z10
X-9Y-67.5
G1Z-6.912F500
Y67.499F1000
G0Z10
X-6Y-68
G1Z-6.912F500
Y67.999F1000
G0Z10
X-3Y-68
G1Z-6.912F500
Y67.999F1000
G0Z10
X0Y-68
G1Z-6.912F500
Y68.499F1000
G0Z10
X3Y-68
G1Z-6.912F500
Y67.999F1000
G0Z10
X6Y-68
G1Z-6.912F500
Y67.999F1000
G0Z10
X9Y-67.5
G1Z-6.912F500
Y67.499F1000
G0Z10
X12Y-67
G1Z-6.912F500
Y66.999F1000
G0Z10
X15Y-66.5
G1Z-6.912F500
Y66.499F1000
G0Z10
X18Y-66
G1Z-6.912F500
Y65.999F1000
G0Z10
X21Y-65
G1Z-6.912F500
Y64.999F1000
G0Z10
X24Y-64
G1Z-6.912F500
Y63.999F1000
G0Z10
X27Y-62.5
G1Z-6.912F500
Y62.499F1000
G0Z10
X30Y-61.5
G1Z-6.912F500
Y61.499F1000
G0Z10
X33Y-60
G1Z-6.912F500
Y59.999F1000
G0Z10
X36Y-58
G1Z-6.912F500
Y57.999F1000
G0Z10
X39Y-56
G1Z-6.912F500
Y55.999F1000
G0Z10
X42Y-54
G1Z-6.912F500
Y53.999F1000
G0Z10
X45Y-51.5
G1Z-6.912F500
Y51.499F1000
G0Z10
X48Y-48.5
G1Z-6.912F500
Y48.499F1000
G0Z10
X51Y-45.5
G1Z-6.912F500
Y45.499F1000
G0Z10
X54Y-42
G1Z-6.912F500
Y41.999F1000
G0Z10
X57Y-37.5
G1Z-6.912F500
Y37.499F1000
G0Z10
X60Y-33
G1Z-6.912F500
Y32.999F1000
G0Z10
X63Y-26.5
G1Z-6.912F500
Y26.499F1000
G0Z10
X66Y-18
G1Z-6.912F500
Y17.999F1000
G0Z10

Plik binarny nie jest wyświetlany.

Wyświetl plik

@ -0,0 +1,273 @@
(Created with grbl post processor 2023/07/06 16:23)
G21
(G-code generated with BlenderCAM and NC library)
G17G90
(Tool: D = 3.0 mm type END flutes 2)
S12000M03
G00 Z10.0
G0X0Y0Z10
X-100Y101.501
G1Z-10F500
X100F1000
X100.036Y101.5
X100.073Y101.499
X100.11Y101.496
X100.147Y101.493
X100.183Y101.489
X100.22Y101.484
X100.256Y101.478
X100.293Y101.472
X100.329Y101.464
X100.364Y101.455
X100.4Y101.446
X100.435Y101.436
X100.47Y101.425
X100.505Y101.413
X100.54Y101.4
X100.574Y101.386
X100.608Y101.372
X100.641Y101.356
X100.674Y101.34
X100.707Y101.323
X100.739Y101.306
X100.771Y101.287
X100.802Y101.268
X100.833Y101.248
X100.864Y101.227
X100.893Y101.205
X100.923Y101.183
X100.951Y101.16
X100.98Y101.136
X101.007Y101.112
X101.034Y101.087
X101.061Y101.061
X101.087Y101.034
X101.112Y101.007
X101.136Y100.98
X101.16Y100.951
X101.183Y100.923
X101.205Y100.893
X101.227Y100.864
X101.248Y100.833
X101.268Y100.802
X101.287Y100.771
X101.306Y100.739
X101.323Y100.707
X101.34Y100.674
X101.356Y100.641
X101.372Y100.608
X101.386Y100.574
X101.4Y100.54
X101.413Y100.505
X101.425Y100.47
X101.436Y100.435
X101.446Y100.4
X101.455Y100.364
X101.464Y100.329
X101.472Y100.292
X101.478Y100.256
X101.484Y100.22
X101.489Y100.183
X101.493Y100.147
X101.496Y100.11
X101.499Y100.073
X101.5Y100.036
X101.501Y100
Y-100
X101.5Y-100.036
X101.499Y-100.073
X101.496Y-100.11
X101.493Y-100.147
X101.489Y-100.183
X101.484Y-100.22
X101.478Y-100.256
X101.472Y-100.293
X101.464Y-100.329
X101.455Y-100.364
X101.446Y-100.4
X101.436Y-100.435
X101.425Y-100.47
X101.413Y-100.505
X101.4Y-100.54
X101.386Y-100.574
X101.372Y-100.608
X101.356Y-100.641
X101.34Y-100.674
X101.323Y-100.707
X101.306Y-100.739
X101.287Y-100.771
X101.268Y-100.802
X101.248Y-100.833
X101.227Y-100.864
X101.205Y-100.893
X101.183Y-100.923
X101.16Y-100.951
X101.136Y-100.98
X101.112Y-101.007
X101.087Y-101.034
X101.061Y-101.061
X101.034Y-101.087
X101.007Y-101.112
X100.98Y-101.136
X100.951Y-101.16
X100.923Y-101.183
X100.893Y-101.205
X100.864Y-101.227
X100.833Y-101.248
X100.802Y-101.268
X100.771Y-101.287
X100.739Y-101.306
X100.707Y-101.323
X100.674Y-101.34
X100.641Y-101.356
X100.608Y-101.372
X100.574Y-101.386
X100.54Y-101.4
X100.505Y-101.413
X100.47Y-101.425
X100.435Y-101.436
X100.4Y-101.446
X100.364Y-101.455
X100.329Y-101.464
X100.292Y-101.472
X100.256Y-101.478
X100.22Y-101.484
X100.183Y-101.489
X100.147Y-101.493
X100.11Y-101.496
X100.073Y-101.499
X100.036Y-101.5
X100Y-101.501
X-100
X-100.036Y-101.5
X-100.073Y-101.499
X-100.11Y-101.496
X-100.147Y-101.493
X-100.183Y-101.489
X-100.22Y-101.484
X-100.256Y-101.478
X-100.293Y-101.472
X-100.329Y-101.464
X-100.364Y-101.455
X-100.4Y-101.446
X-100.435Y-101.436
X-100.47Y-101.425
X-100.505Y-101.413
X-100.54Y-101.4
X-100.574Y-101.386
X-100.608Y-101.372
X-100.641Y-101.356
X-100.674Y-101.34
X-100.707Y-101.323
X-100.739Y-101.306
X-100.771Y-101.287
X-100.802Y-101.268
X-100.833Y-101.248
X-100.864Y-101.227
X-100.893Y-101.205
X-100.923Y-101.183
X-100.951Y-101.16
X-100.98Y-101.136
X-101.007Y-101.112
X-101.034Y-101.087
X-101.061Y-101.061
X-101.087Y-101.034
X-101.112Y-101.007
X-101.136Y-100.98
X-101.16Y-100.951
X-101.183Y-100.923
X-101.205Y-100.893
X-101.227Y-100.864
X-101.248Y-100.833
X-101.268Y-100.802
X-101.287Y-100.771
X-101.306Y-100.739
X-101.323Y-100.707
X-101.34Y-100.674
X-101.356Y-100.641
X-101.372Y-100.608
X-101.386Y-100.574
X-101.4Y-100.54
X-101.413Y-100.505
X-101.425Y-100.47
X-101.436Y-100.435
X-101.446Y-100.4
X-101.455Y-100.364
X-101.464Y-100.329
X-101.472Y-100.292
X-101.478Y-100.256
X-101.484Y-100.22
X-101.489Y-100.183
X-101.493Y-100.147
X-101.496Y-100.11
X-101.499Y-100.073
X-101.5Y-100.036
X-101.501Y-100
Y100
X-101.5Y100.036
X-101.499Y100.073
X-101.496Y100.11
X-101.493Y100.147
X-101.489Y100.183
X-101.484Y100.22
X-101.478Y100.256
X-101.472Y100.293
X-101.464Y100.329
X-101.455Y100.364
X-101.446Y100.4
X-101.436Y100.435
X-101.425Y100.47
X-101.413Y100.505
X-101.4Y100.54
X-101.386Y100.574
X-101.372Y100.608
X-101.356Y100.641
X-101.34Y100.674
X-101.323Y100.707
X-101.306Y100.739
X-101.287Y100.771
X-101.268Y100.802
X-101.248Y100.833
X-101.227Y100.864
X-101.205Y100.893
X-101.183Y100.923
X-101.16Y100.951
X-101.136Y100.98
X-101.112Y101.007
X-101.087Y101.034
X-101.061Y101.061
X-101.034Y101.087
X-101.007Y101.112
X-100.98Y101.136
X-100.951Y101.16
X-100.923Y101.183
X-100.893Y101.205
X-100.864Y101.227
X-100.833Y101.248
X-100.802Y101.268
X-100.771Y101.287
X-100.739Y101.306
X-100.707Y101.323
X-100.674Y101.34
X-100.641Y101.356
X-100.608Y101.372
X-100.574Y101.386
X-100.54Y101.4
X-100.505Y101.413
X-100.47Y101.425
X-100.435Y101.436
X-100.4Y101.446
X-100.364Y101.455
X-100.329Y101.464
X-100.292Y101.472
X-100.256Y101.478
X-100.22Y101.484
X-100.183Y101.489
X-100.147Y101.493
X-100.11Y101.496
X-100.073Y101.499
X-100.036Y101.5
X-100Y101.501
G0Z10

Wyświetl plik

@ -0,0 +1,81 @@
import difflib
import unittest
import subprocess
import os
class BlenderCAMTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.original_dir = os.getcwd()
cls.generator_path = os.path.join(cls.original_dir, "gcode_generator.py")
cls.blend_test_cases = cls.get_test_cases()
@staticmethod
def get_test_cases():
test_cases = []
for root, _, files in os.walk('test_data'):
subdir_name = os.path.basename(root)
blend_file = gcode_files = None
for file in files:
if file.endswith('.blend'):
blend_file = file
elif file.startswith('_') and (file.endswith('.gcode') or file.endswith('.tap')):
gcode_files = gcode_files or []
gcode_files.append(file)
if blend_file and gcode_files:
test_cases.append({
'subdir_name': subdir_name,
'blend_file': blend_file,
'gcode_files': gcode_files
})
return test_cases
@staticmethod
def get_gcode_from_file(file):
with open(file, 'r') as f:
return ''.join(f.readlines()[1:])
@staticmethod
def get_diff(file1, file2, num_lines=10):
with open(file1, 'r') as f1, open(file2, 'r') as f2:
diff = difflib.unified_diff(
f1.readlines()[1:], # skip first line
f2.readlines()[1:], # skip first line
fromfile=file1,
tofile=file2,
)
return ''.join(list(diff)[:num_lines])
def execute_blender(self, blend_file):
command = f'blender -b "{blend_file}" -P "{self.generator_path}"'
subprocess.run(command, shell=True, check=True)
def run_test_case(self, test_case):
# Start in the original working directory
os.chdir(self.original_dir)
blend_dir = os.path.join('test_data', test_case["subdir_name"])
os.chdir(blend_dir)
self.execute_blender(test_case["blend_file"])
# Compare the generated and expected gcode for each operation
for gcode_file in test_case['gcode_files']:
with self.subTest(operation=f"{test_case['subdir_name']}/{gcode_file}"):
try:
generated = self.get_gcode_from_file(gcode_file[1:])
expected = self.get_gcode_from_file(gcode_file)
self.assertMultiLineEqual(generated, expected,
msg = "\n"+self.get_diff(gcode_file[1:], gcode_file))
finally:
os.remove(gcode_file[1:]) # Cleanup generated file
if __name__ == '__main__':
# Add a test method for each test case to the TestCase class
for test_case in BlenderCAMTest.get_test_cases():
test_func = lambda self, tc=test_case: self.run_test_case(tc)
setattr(BlenderCAMTest, f'test_{test_case["subdir_name"]}', test_func)
unittest.main()

Wyświetl plik

@ -35,6 +35,7 @@ from cam import gcodeimportparser, simple
from cam.simple import *
from cam.ui_panels.buttons_panel import CAMButtonsPanel
from cam.ui_panels.interface import *
from cam.ui_panels.info import *
from cam.ui_panels.operations import *
from cam.ui_panels.cutter import *
@ -46,6 +47,9 @@ from cam.ui_panels.movement import *
from cam.ui_panels.feedrate import *
from cam.ui_panels.optimisation import *
from cam.ui_panels.area import *
from cam.ui_panels.gcode import *
from cam.ui_panels.pack import *
from cam.ui_panels.slice import *
class CAM_UL_orientations(UIList):
@ -59,89 +63,6 @@ class CAM_UL_orientations(UIList):
class CAM_GCODE_Panel(CAMButtonsPanel, bpy.types.Panel):
"""CAM operation g-code options panel"""
bl_label = "CAM g-code options "
bl_idname = "WORLD_PT_CAM_GCODE"
COMPAT_ENGINES = {'BLENDERCAM_RENDER'}
def draw(self, context):
layout = self.layout
scene = bpy.context.scene
if len(scene.cam_operations) == 0:
layout.label(text='Add operation first')
if len(scene.cam_operations) > 0:
ao = scene.cam_operations[scene.cam_active_operation]
if ao.valid:
layout.prop(ao, 'output_header')
if ao.output_header:
layout.prop(ao, 'gcode_header')
layout.prop(ao, 'output_trailer')
if ao.output_trailer:
layout.prop(ao, 'gcode_trailer')
layout.prop(ao, 'enable_dust')
if ao.enable_dust:
layout.prop(ao, 'gcode_start_dust_cmd')
layout.prop(ao, 'gcode_stop_dust_cmd')
layout.prop(ao, 'enable_hold')
if ao.enable_hold:
layout.prop(ao, 'gcode_start_hold_cmd')
layout.prop(ao, 'gcode_stop_hold_cmd')
layout.prop(ao, 'enable_mist')
if ao.enable_mist:
layout.prop(ao, 'gcode_start_mist_cmd')
layout.prop(ao, 'gcode_stop_mist_cmd')
else:
layout.label(text='Enable Show experimental features')
layout.label(text='in Blender CAM Addon preferences')
class CAM_PACK_Panel(CAMButtonsPanel, bpy.types.Panel):
"""CAM material panel"""
bl_label = "Pack curves on sheet"
bl_idname = "WORLD_PT_CAM_PACK"
COMPAT_ENGINES = {'BLENDERCAM_RENDER'}
def draw(self, context):
layout = self.layout
scene = bpy.context.scene
settings = scene.cam_pack
layout.label(text='warning - algorithm is slow.')
layout.label(text='only for curves now.')
layout.operator("object.cam_pack_objects")
layout.prop(settings, 'sheet_fill_direction')
layout.prop(settings, 'sheet_x')
layout.prop(settings, 'sheet_y')
layout.prop(settings, 'distance')
layout.prop(settings, 'tolerance')
layout.prop(settings, 'rotate')
if settings.rotate:
layout.prop(settings, 'rotate_angle')
class CAM_SLICE_Panel(CAMButtonsPanel, bpy.types.Panel):
"""CAM slicer panel"""
bl_label = "Slice model to plywood sheets"
bl_idname = "WORLD_PT_CAM_SLICE"
COMPAT_ENGINES = {'BLENDERCAM_RENDER'}
def draw(self, context):
layout = self.layout
scene = bpy.context.scene
settings = scene.cam_slice
layout.operator("object.cam_slice_objects")
layout.prop(settings, 'slice_distance')
layout.prop(settings, 'slice_above0')
layout.prop(settings, 'slice_3d')
layout.prop(settings, 'indexes')
# panel containing all tools

Wyświetl plik

@ -6,75 +6,81 @@ class CAM_AREA_Panel(CAMButtonsPanel, bpy.types.Panel):
"""CAM operation area panel"""
bl_label = "CAM operation area "
bl_idname = "WORLD_PT_CAM_OPERATION_AREA"
panel_interface_level = 0
COMPAT_ENGINES = {'BLENDERCAM_RENDER'}
prop_level = {
'draw_use_layers': 0,
'draw_maxz': 1,
'draw_minz': 1,
'draw_ambient': 1,
'draw_limit_curve': 1
}
def draw(self, context):
self.scene = bpy.context.scene
if not self.has_operations():
self.layout.label(text='Add operation first')
return
self.ao = self.active_operation()
if not self.ao.valid:
return
self.draw_z_limits()
if self.ao.strategy in ['BLOCK', 'SPIRAL', 'CIRCLES', 'PARALLEL', 'CROSS']:
self.draw_xy_limits()
# Draw layers option: use layers(y/n) and choose the stepdown
def draw_z_limits(self):
def draw_use_layers(self):
if not self.has_correct_level(): return
row = self.layout.row(align=True)
row.prop(self.ao, 'use_layers')
if self.ao.use_layers:
row.prop(self.ao, 'stepdown')
row.prop(self.op, 'use_layers')
if self.op.use_layers:
row.prop(self.op, 'stepdown')
self.layout.prop(self.ao, 'maxz')
def draw_maxz(self):
if not self.has_correct_level(): return
self.layout.prop(self.op, 'maxz')
if self.op.maxz > self.op.movement.free_height:
self.layout.prop(self.op.movement, 'free_height')
self.layout.label(text='POSSIBLE COLLISION: Depth start > Free movement')
if self.ao.maxz > self.ao.movement.free_height:
self.layout.prop(self.ao.movement, 'free_height')
self.layout.label(text='Depth start > Free movement')
self.layout.label(text='POSSIBLE COLLISION')
if self.ao.geometry_source in ['OBJECT', 'COLLECTION']:
if self.ao.strategy == 'CURVE':
def draw_minz(self):
if not self.has_correct_level(): return
if self.op.geometry_source in ['OBJECT', 'COLLECTION']:
if self.op.strategy == 'CURVE':
self.layout.label(text="cannot use depth from object using CURVES")
if not self.ao.minz_from_ob:
if not self.ao.minz_from_material:
self.layout.prop(self.ao, 'minz')
self.layout.prop(self.ao, 'minz_from_material')
if not self.ao.minz_from_material:
self.layout.prop(self.ao, 'minz_from_ob')
if not self.op.minz_from_ob:
if not self.op.minz_from_material:
self.layout.prop(self.op, 'minz')
self.layout.prop(self.op, 'minz_from_material')
if not self.op.minz_from_material:
self.layout.prop(self.op, 'minz_from_ob')
else:
self.layout.prop(self.ao, 'source_image_scale_z')
self.layout.prop(self.ao, 'source_image_size_x')
if self.ao.source_image_name != '':
i = bpy.data.images[self.ao.source_image_name]
self.layout.prop(self.op, 'source_image_scale_z')
self.layout.prop(self.op, 'source_image_size_x')
if self.op.source_image_name != '':
i = bpy.data.images[self.op.source_image_name]
if i is not None:
sy = int((self.ao.source_image_size_x / i.size[0]) * i.size[1] * 1000000) / 1000
sy = int((self.op.source_image_size_x / i.size[0]) * i.size[1] * 1000000) / 1000
self.layout.label(text='image size on y axis: ' + strInUnits(sy, 8))
self.layout.separator()
self.layout.prop(self.ao, 'source_image_offset')
self.layout.prop(self.op, 'source_image_offset')
col = self.layout.column(align=True)
col.prop(self.ao, 'source_image_crop', text='Crop source image')
if self.ao.source_image_crop:
col.prop(self.ao, 'source_image_crop_start_x', text='start x')
col.prop(self.ao, 'source_image_crop_start_y', text='start y')
col.prop(self.ao, 'source_image_crop_end_x', text='end x')
col.prop(self.ao, 'source_image_crop_end_y', text='end y')
col.prop(self.op, 'source_image_crop', text='Crop source image')
if self.op.source_image_crop:
col.prop(self.op, 'source_image_crop_start_x', text='start x')
col.prop(self.op, 'source_image_crop_start_y', text='start y')
col.prop(self.op, 'source_image_crop_end_x', text='end x')
col.prop(self.op, 'source_image_crop_end_y', text='end y')
def draw_xy_limits(self):
self.layout.prop(self.ao, 'ambient_behaviour')
if self.ao.ambient_behaviour == 'AROUND':
self.layout.prop(self.ao, 'ambient_radius')
def draw_ambient(self):
if not self.has_correct_level(): return
if self.op.strategy in ['BLOCK', 'SPIRAL', 'CIRCLES', 'PARALLEL', 'CROSS']:
self.layout.prop(self.op, 'ambient_behaviour')
if self.op.ambient_behaviour == 'AROUND':
self.layout.prop(self.op, 'ambient_radius')
self.layout.prop(self.op, "ambient_cutter_restrict")
self.layout.prop(self.ao, 'use_limit_curve')
def draw_limit_curve(self):
if not self.has_correct_level(): return
if self.op.strategy in ['BLOCK', 'SPIRAL', 'CIRCLES', 'PARALLEL', 'CROSS']:
self.layout.prop(self.op, 'use_limit_curve')
if self.op.use_limit_curve:
self.layout.prop_search(self.op, "limit_curve", bpy.data, "objects")
if self.ao.use_limit_curve:
self.layout.prop_search(self.ao, "limit_curve", bpy.data, "objects")
def draw(self, context):
self.context = context
self.draw_use_layers()
self.draw_maxz()
self.draw_minz()
self.draw_ambient()
self.draw_limit_curve()
self.layout.prop(self.ao, "ambient_cutter_restrict")

Wyświetl plik

@ -1,4 +1,5 @@
import bpy
import inspect
# Panel definitions
class CAMButtonsPanel:
@ -6,6 +7,7 @@ class CAMButtonsPanel:
bl_region_type = 'WINDOW'
bl_context = "render"
always_show_panel = False
COMPAT_ENGINES = {'BLENDERCAM_RENDER'}
# COMPAT_ENGINES must be defined in each subclass, external engines can add themselves here
@ -17,7 +19,10 @@ class CAMButtonsPanel:
return True
op = cls.active_operation()
if op and op.valid:
return True
if hasattr(cls, 'panel_interface_level'):
return cls.panel_interface_level <= int(context.scene.interface.level)
else:
return True
return False
@classmethod
@ -43,3 +48,13 @@ class CAMButtonsPanel:
def has_operations(self):
return (self.operations_count() > 0)
def has_correct_level(self):
if not hasattr(self, 'prop_level'):
return True
caller_function = inspect.stack()[1][3]
if not caller_function in self.prop_level:
return True
return self.prop_level[caller_function] <= int(self.context.scene.interface.level)

Wyświetl plik

@ -36,8 +36,7 @@ class CAM_CHAINS_Panel(CAMButtonsPanel, bpy.types.Panel):
"""CAM chains panel"""
bl_label = "CAM chains"
bl_idname = "WORLD_PT_CAM_CHAINS"
COMPAT_ENGINES = {'BLENDERCAM_RENDER'}
panel_interface_level = 1
def draw(self, context):
layout = self.layout

Wyświetl plik

@ -5,88 +5,133 @@ from cam.ui_panels.buttons_panel import CAMButtonsPanel
class CAM_CUTTER_Panel(CAMButtonsPanel, bpy.types.Panel):
"""CAM cutter panel"""
bl_label = " "
bl_label = "CAM Cutter"
bl_idname = "WORLD_PT_CAM_CUTTER"
panel_interface_level = 0
COMPAT_ENGINES = {'BLENDERCAM_RENDER'}
prop_level = {
'draw_cutter_preset_menu': 1,
'draw_cutter_id': 2,
'draw_cutter_type': 0,
'draw_ball_radius': 0,
'draw_bull_radius': 0,
'draw_cylcone_diameter': 0,
'draw_cutter_tip_angle': 0,
'draw_laser': 0,
'draw_plasma': 0,
'draw_custom': 0,
'draw_cutter_diameter': 0,
'draw_cutter_flutes': 1,
'draw_cutter_description': 1,
'draw_engagement': 0
}
def draw_cutter_preset_menu(self):
if not self.has_correct_level(): return
row = self.layout.row(align=True)
row.menu("CAM_CUTTER_MT_presets", text=bpy.types.CAM_CUTTER_MT_presets.bl_label)
row.operator("render.cam_preset_cutter_add", text="", icon='ADD')
row.operator("render.cam_preset_cutter_add", text="", icon='REMOVE').remove_active = True
# Displays percentage of the cutter which is engaged with the material
# Displays a warning for engagements greater than 50%
def EngagementDisplay(self, operat, layout):
ao = operat
def draw_cutter_id(self):
if not self.has_correct_level(): return
self.layout.prop(self.op, 'cutter_id')
if ao.cutter_type == 'BALLCONE':
if ao.dist_between_paths > ao.ball_radius:
layout.label(text="CAUTION: CUTTER ENGAGEMENT")
layout.label(text="GREATER THAN 50%")
layout.label(text="Cutter engagement: " + str(round(100 * ao.dist_between_paths / ao.ball_radius, 1)) + "%")
def draw_cutter_type(self):
if not self.has_correct_level(): return
self.layout.prop(self.op, 'cutter_type')
def draw_ball_radius(self):
if not self.has_correct_level(): return
if self.op.cutter_type in ['BALLCONE']:
self.layout.prop(self.op, 'ball_radius')
def draw_bull_radius(self):
if not self.has_correct_level(): return
if self.op.cutter_type in ['BULLNOSE']:
self.layout.prop(self.op, 'bull_corner_radius')
def draw_cylcone_diameter(self):
if not self.has_correct_level(): return
if self.op.cutter_type in ['CYLCONE']:
self.layout.prop(self.op, 'cylcone_diameter')
def draw_cutter_tip_angle(self):
if not self.has_correct_level(): return
if self.op.cutter_type in ['VCARVE', 'BALLCONE', 'BULLNOSE', 'CYLCONE']:
self.layout.prop(self.op, 'cutter_tip_angle')
def draw_laser(self):
if not self.has_correct_level(): return
if self.op.cutter_type in ['LASER']:
self.layout.prop(self.op, 'Laser_on')
self.layout.prop(self.op, 'Laser_off')
self.layout.prop(self.op, 'Laser_cmd')
self.layout.prop(self.op, 'Laser_delay')
def draw_plasma(self):
if not self.has_correct_level(): return
if self.op.cutter_type in ['PLASMA']:
self.layout.prop(self.op, 'Plasma_on')
self.layout.prop(self.op, 'Plasma_off')
self.layout.prop(self.op, 'Plasma_delay')
self.layout.prop(self.op, 'Plasma_dwell')
self.layout.prop(self.op, 'lead_in')
self.layout.prop(self.op, 'lead_out')
def draw_custom(self):
if not self.has_correct_level(): return
if self.op.cutter_type in ['CUSTOM']:
if self.op.optimisation.use_exact:
self.layout.label(text='Warning - only convex shapes are supported. ', icon='COLOR_RED')
self.layout.label(text='If your custom cutter is concave,')
self.layout.label(text='switch exact mode off.')
self.layout.prop_search(self.op, "cutter_object_name", bpy.data, "objects")
def draw_cutter_diameter(self):
if not self.has_correct_level(): return
self.layout.prop(self.op, 'cutter_diameter')
def draw_cutter_flutes(self):
if not self.has_correct_level(): return
if self.op.cutter_type not in ['LASER', 'PLASMA']:
self.layout.prop(self.op, 'cutter_flutes')
def draw_cutter_description(self):
if not self.has_correct_level(): return
self.layout.prop(self.op, 'cutter_description')
def draw_engagement(self):
if not self.has_correct_level(): return
if self.op.cutter_type in ['LASER', 'PLASMA']: return
if self.op.strategy in ['CUTOUT']: return
if self.op.cutter_type in ['BALLCONE']:
engagement = round(100 * self.op.dist_between_paths / self.op.ball_radius, 1)
else:
if ao.dist_between_paths > ao.cutter_diameter / 2:
layout.label(text="CAUTION: CUTTER ENGAGEMENT")
layout.label(text="GREATER THAN 50%")
layout.label(text="Cutter Engagement: " + str(round(100 * ao.dist_between_paths / ao.cutter_diameter, 1)) + "%")
engagement = round(100 * self.op.dist_between_paths / self.op.cutter_diameter, 1)
def draw_header(self, context):
self.layout.menu("CAM_CUTTER_MT_presets", text="CAM Cutter")
self.layout.label(text=f"Cutter engagement: {engagement}%")
if engagement > 50:
self.layout.label(text="WARNING: CUTTER ENGAGEMENT > 50%")
def draw(self, context):
layout = self.layout
d = bpy.context.scene
if len(d.cam_operations) > 0:
ao = d.cam_operations[d.cam_active_operation]
self.context = context
if ao:
# cutter preset
row = layout.row(align=True)
row.menu("CAM_CUTTER_MT_presets", text=bpy.types.CAM_CUTTER_MT_presets.bl_label)
row.operator("render.cam_preset_cutter_add", text="", icon='ADD')
row.operator("render.cam_preset_cutter_add", text="", icon='REMOVE').remove_active = True
layout.prop(ao, 'cutter_id')
layout.prop(ao, 'cutter_type')
if ao.cutter_type == 'VCARVE':
layout.prop(ao, 'cutter_tip_angle')
if ao.cutter_type == 'BALLCONE':
layout.prop(ao, 'ball_radius')
self.EngagementDisplay(ao, layout)
layout.prop(ao, 'cutter_tip_angle')
layout.label(text='Cutter diameter = shank diameter')
if ao.cutter_type == 'CYLCONE':
layout.prop(ao, 'cylcone_diameter')
self.EngagementDisplay(ao, layout)
layout.prop(ao, 'cutter_tip_angle')
layout.label(text='Cutter diameter = shank diameter')
if ao.cutter_type == 'BULLNOSE':
layout.prop(ao, 'bull_corner_radius')
self.EngagementDisplay(ao, layout)
layout.label(text='Cutter diameter = shank diameter')
self.draw_cutter_preset_menu()
self.draw_cutter_id()
self.draw_cutter_type()
self.draw_ball_radius()
self.draw_bull_radius()
self.draw_cylcone_diameter()
self.draw_cutter_tip_angle()
self.draw_laser()
self.draw_plasma()
self.draw_custom()
self.draw_cutter_diameter()
self.draw_cutter_flutes()
self.draw_cutter_description()
self.draw_engagement()
if ao.cutter_type == 'LASER':
layout.prop(ao, 'Laser_on')
layout.prop(ao, 'Laser_off')
layout.prop(ao, 'Laser_cmd')
layout.prop(ao, 'Laser_delay')
if ao.cutter_type == 'PLASMA':
layout.prop(ao, 'Plasma_on')
layout.prop(ao, 'Plasma_off')
layout.prop(ao, 'Plasma_delay')
layout.prop(ao, 'Plasma_dwell')
layout.prop(ao, 'lead_in')
layout.prop(ao, 'lead_out')
if ao.cutter_type == 'CUSTOM':
if ao.optimisation.use_exact:
layout.label(text='Warning - only convex shapes are supported. ', icon='COLOR_RED')
layout.label(text='If your custom cutter is concave,')
layout.label(text='switch exact mode off.')
layout.prop_search(ao, "cutter_object_name", bpy.data, "objects")
layout.prop(ao, 'cutter_diameter')
if ao.strategy == "POCKET" or ao.strategy == "PARALLEL" or ao.strategy == "CROSS" \
or ao.strategy == "WATERLINE":
self.EngagementDisplay(ao, layout)
if ao.cutter_type != "LASER":
layout.prop(ao, 'cutter_flutes')
layout.prop(ao, 'cutter_description')

Wyświetl plik

@ -5,19 +5,41 @@ class CAM_FEEDRATE_Panel(CAMButtonsPanel, bpy.types.Panel):
"""CAM feedrate panel"""
bl_label = "CAM feedrate"
bl_idname = "WORLD_PT_CAM_FEEDRATE"
panel_interface_level = 0
COMPAT_ENGINES = {'BLENDERCAM_RENDER'}
prop_level = {
'draw_feedrate': 0,
'draw_sim_feedrate': 2,
'draw_plunge_feedrate': 1,
'draw_plunge_angle': 1,
'draw_spindle_rpm': 0
}
def draw_feedrate(self):
if not self.has_correct_level(): return
self.layout.prop(self.op, 'feedrate')
def draw_sim_feedrate(self):
if not self.has_correct_level(): return
self.layout.prop(self.op, 'do_simulation_feedrate')
def draw_plunge_feedrate(self):
if not self.has_correct_level(): return
self.layout.prop(self.op, 'plunge_feedrate')
def draw_plunge_angle(self):
if not self.has_correct_level(): return
self.layout.prop(self.op, 'plunge_angle')
def draw_spindle_rpm(self):
if not self.has_correct_level(): return
self.layout.prop(self.op, 'spindle_rpm')
def draw(self, context):
if not self.has_operations():
self.layout.label(text='Add operation first')
return
self.context = context
ao = self.active_operation()
if not ao.valid: return
self.layout.prop(ao, 'feedrate')
self.layout.prop(ao, 'do_simulation_feedrate')
self.layout.prop(ao, 'plunge_feedrate')
self.layout.prop(ao, 'plunge_angle')
self.layout.prop(ao, 'spindle_rpm')
self.draw_feedrate()
self.draw_sim_feedrate()
self.draw_plunge_feedrate()
self.draw_plunge_angle()
self.draw_spindle_rpm()

Wyświetl plik

@ -0,0 +1,60 @@
import bpy
from cam.ui_panels.buttons_panel import CAMButtonsPanel
class CAM_GCODE_Panel(CAMButtonsPanel, bpy.types.Panel):
"""CAM operation g-code options panel"""
bl_label = "CAM g-code options "
bl_idname = "WORLD_PT_CAM_GCODE"
panel_interface_level = 1
prop_level = {
'draw_output_header': 1,
'draw_output_trailer': 1,
'draw_enable_dust': 1,
'draw_enable_hold': 1,
'draw_enable_mist': 1
}
def draw_output_header(self):
if not self.has_correct_level(): return
self.layout.prop(self.op, 'output_header')
if self.op.output_header:
self.layout.prop(self.op, 'gcode_header')
def draw_output_trailer(self):
if not self.has_correct_level(): return
self.layout.prop(self.op, 'output_trailer')
if self.op.output_trailer:
self.layout.prop(self.op, 'gcode_trailer')
def draw_enable_dust(self):
if not self.has_correct_level(): return
self.layout.prop(self.op, 'enable_dust')
if self.op.enable_dust:
self.layout.prop(self.op, 'gcode_start_dust_cmd')
self.layout.prop(self.op, 'gcode_stop_dust_cmd')
def draw_enable_hold(self):
if not self.has_correct_level(): return
self.layout.prop(self.op, 'enable_hold')
if self.op.enable_hold:
self.layout.prop(self.op, 'gcode_start_hold_cmd')
self.layout.prop(self.op, 'gcode_stop_hold_cmd')
def draw_enable_mist(self):
if not self.has_correct_level(): return
self.layout.prop(self.op, 'enable_mist')
if self.op.enable_mist:
self.layout.prop(self.op, 'gcode_start_mist_cmd')
self.layout.prop(self.op, 'gcode_stop_mist_cmd')
def draw(self, context):
self.context = context
self.draw_output_header()
self.draw_output_trailer()
self.draw_enable_dust()
self.draw_enable_hold()
self.draw_enable_mist()

Wyświetl plik

@ -28,23 +28,21 @@ class CAM_INFO_Properties(bpy.types.PropertyGroup):
class CAM_INFO_Panel(CAMButtonsPanel, bpy.types.Panel):
"""CAM info panel"""
bl_label = "CAM info & warnings"
bl_idname = "WORLD_PT_CAM_INFO"
panel_interface_level = 0
COMPAT_ENGINES = {'BLENDERCAM_RENDER'}
# Display the Info Panel
def draw(self, context):
self.draw_opencamlib_version()
if self.has_operations():
self.draw_op_warnings()
self.draw_op_time()
self.draw_op_money_cost()
prop_level = {
'draw_opencamlib_version': 1,
'draw_op_warnings': 0,
'draw_op_time': 0,
'draw_op_chipload': 0,
'draw_op_money_cost': 1
}
# Display the OpenCamLib version
def draw_opencamlib_version(self):
if not self.has_correct_level(): return
opencamlib_version = cam.utils.opencamlib_version()
if opencamlib_version is None:
self.layout.label(text="Opencamlib is not installed")
@ -54,23 +52,18 @@ class CAM_INFO_Panel(CAMButtonsPanel, bpy.types.Panel):
# Display warnings related to the current operation
def draw_op_warnings(self):
if self.op is None:
return
if not self.has_correct_level(): return
for line in self.op.info.warnings.rstrip("\n").split("\n"):
if len(line) > 0:
self.layout.label(text=line, icon='ERROR')
# Display the time estimation for the current operation
def draw_op_time(self):
if self.op is None:
return
if not self.op.valid:
return
if not self.has_correct_level(): return
if not int(self.op.info.duration * 60) > 0:
return
time_estimate = f"Operation Time: {int(self.op.info.duration*60)}s "
time_estimate = f"Operation duration: {int(self.op.info.duration*60)}s "
if self.op.info.duration > 60:
time_estimate += f" ({int(self.op.info.duration / 60)}h"
time_estimate += f" {round(self.op.info.duration % 60)}min)"
@ -81,10 +74,7 @@ class CAM_INFO_Panel(CAMButtonsPanel, bpy.types.Panel):
# Display the chipload (does this work ?)
def draw_op_chipload(self):
if self.op is None:
return
if not self.op.valid:
return
if not self.has_correct_level(): return
if not self.op.info.chipload > 0:
return
@ -93,8 +83,7 @@ class CAM_INFO_Panel(CAMButtonsPanel, bpy.types.Panel):
# Display the current operation money cost
def draw_op_money_cost(self):
if self.op is None or not self.op.valid:
return
if not self.has_correct_level(): return
if not int(self.op.info.duration * 60) > 0:
return
@ -109,3 +98,11 @@ class CAM_INFO_Panel(CAMButtonsPanel, bpy.types.Panel):
total_cost = self.op.info.duration * 60 * cost_per_second
op_cost = f"Operation cost: ${total_cost:.2f} (${cost_per_second:.2f}/s)"
self.layout.label(text=op_cost)
# Display the Info Panel
def draw(self, context):
self.context = context
self.draw_opencamlib_version()
self.draw_op_warnings()
self.draw_op_time()
self.draw_op_money_cost()

Wyświetl plik

@ -0,0 +1,29 @@
import bpy
import math
from cam.ui_panels.buttons_panel import CAMButtonsPanel
import cam.utils
import cam.constants
class CAM_INTERFACE_Properties(bpy.types.PropertyGroup):
level: bpy.props.EnumProperty(
name="Interface",
description="Choose visible options",
items=[('0', "Basic", "Only show essential options"),
('1', "Advanced", "Show advanced options"),
('2', "Complete", "Show all options"),
('3', "Experimental", "Show experimental options")],
default='0',
)
class CAM_INTERFACE_Panel(CAMButtonsPanel, bpy.types.Panel):
bl_label = "Interface"
bl_idname = "WORLD_PT_CAM_INTERFACE"
always_show_panel = True
def draw_interface_level(self):
self.layout.prop(self.context.scene.interface, 'level', text='')
def draw(self, context):
self.context = context
self.draw_interface_level()

Wyświetl plik

@ -4,60 +4,116 @@ from cam.ui_panels.buttons_panel import CAMButtonsPanel
class CAM_MACHINE_Panel(CAMButtonsPanel, bpy.types.Panel):
"""CAM machine panel"""
bl_label = " "
bl_label = "CAM Machine"
bl_idname = "WORLD_PT_CAM_MACHINE"
always_show_panel = True
panel_interface_level = 0
COMPAT_ENGINES = {'BLENDERCAM_RENDER'}
prop_level = {
'draw_presets': 1,
'draw_post_processor': 0,
'draw_split_files': 2,
'draw_system': 1,
'draw_position_definitions': 2,
'draw_working_area': 2,
'draw_feedrates': 2,
'draw_splindle_speeds': 2,
'draw_tool_options': 2,
'draw_suplemental_axis': 2,
'draw_collet_size': 2,
'draw_block_numbers': 2,
'draw_hourly_rate': 2
}
def draw_header(self, context):
self.layout.menu("CAM_MACHINE_MT_presets", text="CAM Machine")
def draw_presets(self):
if not self.has_correct_level(): return
row = self.layout.row(align=True)
row.menu("CAM_MACHINE_MT_presets", text=bpy.types.CAM_MACHINE_MT_presets.bl_label)
row.operator("render.cam_preset_machine_add", text="", icon='ADD')
row.operator("render.cam_preset_machine_add", text="", icon='REMOVE').remove_active = True
def draw_post_processor(self):
if not self.has_correct_level(): return
self.layout.prop(self.machine, 'post_processor')
def draw_split_files(self):
if not self.has_correct_level(): return
self.layout.prop(self.machine, 'eval_splitting')
if self.machine.eval_splitting:
self.layout.prop(self.machine, 'split_limit')
def draw_system(self):
if not self.has_correct_level(): return
self.layout.prop(bpy.context.scene.unit_settings, 'system')
def draw_position_definitions(self):
if not self.has_correct_level(): return
self.layout.prop(self.machine, 'use_position_definitions')
if self.machine.use_position_definitions:
self.layout.prop(self.machine, 'starting_position')
self.layout.prop(self.machine, 'mtc_position')
self.layout.prop(self.machine, 'ending_position')
def draw_working_area(self):
if not self.has_correct_level(): return
self.layout.prop(self.machine, 'working_area')
def draw_feedrates(self):
if not self.has_correct_level(): return
self.layout.prop(self.machine, 'feedrate_min')
self.layout.prop(self.machine, 'feedrate_max')
self.layout.prop(self.machine, 'feedrate_default')
def draw_splindle_speeds(self):
if not self.has_correct_level(): return
# TODO: spindle default and feedrate default should become part of the cutter definition...
self.layout.prop(self.machine, 'spindle_min')
self.layout.prop(self.machine, 'spindle_max')
self.layout.prop(self.machine, 'spindle_start_time')
self.layout.prop(self.machine, 'spindle_default')
def draw_tool_options(self):
if not self.has_correct_level(): return
self.layout.prop(self.machine, 'output_tool_definitions')
self.layout.prop(self.machine, 'output_tool_change')
if self.machine.output_tool_change:
self.layout.prop(self.machine, 'output_g43_on_tool_change')
def draw_suplemental_axis(self):
if not self.has_correct_level(): return
self.layout.prop(self.machine, 'axis4')
self.layout.prop(self.machine, 'axis5')
def draw_collet_size(self):
if not self.has_correct_level(): return
self.layout.prop(self.machine, 'collet_size')
def draw_block_numbers(self):
if not self.has_correct_level(): return
self.layout.prop(self.machine, 'output_block_numbers')
if self.machine.output_block_numbers:
self.layout.prop(self.machine, 'start_block_number')
self.layout.prop(self.machine, 'block_number_increment')
def draw_hourly_rate(self):
if not self.has_correct_level(): return
self.layout.prop(self.machine, 'hourly_rate')
def draw(self, context):
layout = self.layout
s = bpy.context.scene
us = s.unit_settings
self.context = context
self.machine = bpy.context.scene.cam_machine
ao = s.cam_machine
self.draw_presets()
self.draw_post_processor()
self.draw_split_files()
self.draw_system()
self.draw_position_definitions()
self.draw_working_area()
self.draw_feedrates()
self.draw_splindle_speeds()
self.draw_tool_options()
self.draw_suplemental_axis()
self.draw_collet_size()
self.draw_block_numbers()
self.draw_hourly_rate()
if ao:
# machine preset
row = layout.row(align=True)
row.menu("CAM_MACHINE_MT_presets", text=bpy.types.CAM_MACHINE_MT_presets.bl_label)
row.operator("render.cam_preset_machine_add", text="", icon='ADD')
row.operator("render.cam_preset_machine_add", text="", icon='REMOVE').remove_active = True
layout.prop(ao, 'post_processor')
layout.prop(ao, 'eval_splitting')
if ao.eval_splitting:
layout.prop(ao, 'split_limit')
layout.prop(us, 'system')
layout.prop(ao, 'use_position_definitions')
if ao.use_position_definitions:
layout.prop(ao, 'starting_position')
layout.prop(ao, 'mtc_position')
layout.prop(ao, 'ending_position')
layout.prop(ao, 'working_area')
layout.prop(ao, 'feedrate_min')
layout.prop(ao, 'feedrate_max')
layout.prop(ao, 'feedrate_default')
# TODO: spindle default and feedrate default should become part of the cutter definition...
layout.prop(ao, 'spindle_min')
layout.prop(ao, 'spindle_max')
layout.prop(ao, 'spindle_start_time')
layout.prop(ao, 'spindle_default')
layout.prop(ao, 'output_tool_definitions')
layout.prop(ao, 'output_tool_change')
if ao.output_tool_change:
layout.prop(ao, 'output_g43_on_tool_change')
if self.use_experimental:
layout.prop(ao, 'axis4')
layout.prop(ao, 'axis5')
layout.prop(ao, 'collet_size')
layout.prop(ao, 'output_block_numbers')
if ao.output_block_numbers:
layout.prop(ao, 'start_block_number')
layout.prop(ao, 'block_number_increment')
layout.prop(ao, 'hourly_rate')

Wyświetl plik

@ -64,6 +64,7 @@ class CAM_MATERIAL_PositionObject(bpy.types.Operator):
bl_idname = "object.material_cam_position"
bl_label = "position object for CAM operation"
bl_options = {'REGISTER', 'UNDO'}
interface_level = 0
def execute(self, context):
s = bpy.context.scene
@ -75,53 +76,55 @@ class CAM_MATERIAL_PositionObject(bpy.types.Operator):
return {'FINISHED'}
def draw(self, context):
if not self.interface_level <= int(self.context.scene.interface.level): return
self.layout.prop_search(self, "operation", bpy.context.scene, "cam_operations")
class CAM_MATERIAL_Panel(CAMButtonsPanel, bpy.types.Panel):
bl_label = "CAM Material size and position"
bl_idname = "WORLD_PT_CAM_MATERIAL"
panel_interface_level = 0
COMPAT_ENGINES = {'BLENDERCAM_RENDER'}
prop_level = {
'draw_estimate_from_image': 0,
'draw_estimate_from_object': 1,
'draw_axis_alignment': 0
}
def draw_estimate_from_image(self):
if not self.has_correct_level(): return
if self.op.geometry_source not in ['OBJECT', 'COLLECTION']:
self.layout.label(text='Estimated from image')
def draw_estimate_from_object(self):
if not self.has_correct_level(): return
if self.op.geometry_source in ['OBJECT', 'COLLECTION']:
self.layout.prop(self.op.material, 'estimate_from_model')
if self.op.material.estimate_from_model:
row_radius = self.layout.row()
row_radius.label(text="Additional radius")
row_radius.prop(self.op.material, 'radius_around_model', text='')
else:
self.layout.prop(self.op.material, 'origin')
self.layout.prop(self.op.material, 'size')
# Display Axis alignment section
def draw_axis_alignment(self):
if not self.has_correct_level(): return
if self.op.geometry_source in ['OBJECT', 'COLLECTION']:
row_axis = self.layout.row()
row_axis.prop(self.op.material, 'center_x')
row_axis.prop(self.op.material, 'center_y')
self.layout.prop(self.op.material, 'z_position')
self.layout.operator("object.material_cam_position", text="Position object")
def draw(self, context):
if self.op is None:
return
self.context = context
# FIXME: This function displays the progression of a job with a progress bar
# Commenting because it makes no sense here
# Consider removing it entirely
# self.layout.template_running_jobs()
if self.op.geometry_source not in ['OBJECT', 'COLLECTION']:
self.layout.label(text='Estimated from image')
return
self.layout.prop(self.op.material, 'estimate_from_model')
if self.op.material.estimate_from_model:
self.draw_estimate_material_from_model()
else:
self.draw_custom_material_size_and_origin()
self.draw_estimate_from_image()
self.draw_estimate_from_object()
self.draw_axis_alignment()
# Display section selecting the radius around the model
def draw_estimate_material_from_model(self):
row_radius = self.layout.row()
row_radius.label(text="Additional radius")
row_radius.prop(self.op.material, 'radius_around_model', text='')
# Display section showing custom material size
def draw_custom_material_size_and_origin(self):
self.layout.prop(self.op.material, 'origin')
self.layout.prop(self.op.material, 'size')
# Display Axis alignment section
def draw_axis_alignment(self):
row_axis = self.layout.row()
row_axis.prop(self.op.material, 'center_x')
row_axis.prop(self.op.material, 'center_y')
self.layout.prop(self.op.material, 'z_position')
self.layout.operator("object.material_cam_position", text="Position object")

Wyświetl plik

@ -108,34 +108,53 @@ class CAM_MOVEMENT_Panel(CAMButtonsPanel, bpy.types.Panel):
"""CAM movement panel"""
bl_label = "CAM movement"
bl_idname = "WORLD_PT_CAM_MOVEMENT"
panel_interface_level = 0
COMPAT_ENGINES = {'BLENDERCAM_RENDER'}
prop_level = {
'draw_cut_type': 1,
'draw_spindle_rotation': 2,
'draw_free_height': 0,
'draw_use_g64': 2,
'draw_parallel_stepback': 1,
'draw_first_down': 1,
'draw_helix_enter': 2,
'draw_ramp': 1,
'draw_retract_tangential': 2,
'draw_stay_low': 1,
'draw_protect_vertical': 1
}
def draw_cut_type(self):
if not self.has_correct_level(): return
self.layout.prop(self.op.movement, 'type')
if self.op.movement.type in ['BLOCK', 'SPIRAL', 'CIRCLES']:
self.layout.prop(self.op.movement, 'insideout')
def draw_spindle_rotation(self):
if not self.has_correct_level(): return
self.layout.prop(self.op.movement, 'spindle_rotation')
def draw_free_height(self):
if not self.has_correct_level(): return
self.layout.prop(self.op.movement, 'free_height')
if self.op.maxz > self.op.movement.free_height:
self.layout.label(text='Depth start > Free movement')
self.layout.label(text='POSSIBLE COLLISION')
def draw_use_g64(self):
if not self.has_correct_level(): return
self.layout.prop(self.op.movement, 'useG64')
if self.op.movement.useG64:
self.layout.prop(self.op.movement, 'G64')
def draw_parallel_stepback(self):
if not self.has_correct_level(): return
if self.op.strategy in ['PARALLEL','CROSS']:
if not self.op.movement.ramp:
self.layout.prop(self.op.movement, 'parallel_step_back')
def draw_helix_enter(self):
if not self.has_correct_level(): return
if self.op.strategy in ['POCKET']:
self.layout.prop(self.op.movement, 'helix_enter')
if self.op.movement.helix_enter:
@ -143,10 +162,12 @@ class CAM_MOVEMENT_Panel(CAMButtonsPanel, bpy.types.Panel):
self.layout.prop(self.op.movement, 'helix_diameter')
def draw_first_down(self):
if not self.has_correct_level(): return
if self.op.strategy in ['CUTOUT','POCKET','MEDIAL_AXIS']:
self.layout.prop(self.op.movement, 'first_down')
def draw_ramp(self):
if not self.has_correct_level(): return
self.layout.prop(self.op.movement, 'ramp')
if self.op.movement.ramp:
self.layout.prop(self.op.movement, 'ramp_in_angle')
@ -155,6 +176,7 @@ class CAM_MOVEMENT_Panel(CAMButtonsPanel, bpy.types.Panel):
self.layout.prop(self.movement, 'ramp_out_angle')
def draw_retract_tangential(self):
if not self.has_correct_level(): return
if self.op.strategy in ['POCKET']:
self.layout.prop(self.op.movement, 'retract_tangential')
if self.op.movement.retract_tangential:
@ -162,11 +184,13 @@ class CAM_MOVEMENT_Panel(CAMButtonsPanel, bpy.types.Panel):
self.layout.prop(self.op.movement, 'retract_height')
def draw_stay_low(self):
if not self.has_correct_level(): return
self.layout.prop(self.op.movement, 'stay_low')
if self.op.movement.stay_low:
self.layout.prop(self.op.movement, 'merge_dist')
def draw_protect_vertical(self):
if not self.has_correct_level(): return
if self.op.cutter_type not in ['BALLCONE']:
self.layout.prop(self.op.movement, 'protect_vertical')
if self.op.movement.protect_vertical:
@ -174,10 +198,6 @@ class CAM_MOVEMENT_Panel(CAMButtonsPanel, bpy.types.Panel):
def draw(self, context):
self.context = context
scene = bpy.context.scene
if not self.op.valid:
return
self.draw_cut_type()
self.draw_spindle_rotation()

Wyświetl plik

@ -7,170 +7,219 @@ class CAM_OPERATION_PROPERTIES_Panel(CAMButtonsPanel, bpy.types.Panel):
"""CAM operation properties panel"""
bl_label = "CAM operation setup"
bl_idname = "WORLD_PT_CAM_OPERATION"
panel_interface_level = 0
COMPAT_ENGINES = {'BLENDERCAM_RENDER'}
prop_level = {
'draw_cutter_engagement': 0,
'draw_machine_axis': 2,
'draw_strategy': 0,
'draw_enable_A_B_axis': 1,
'draw_cutout_options': 0,
'draw_waterline_options': 0,
'draw_medial_axis_options': 0,
'draw_drill_options': 0,
'draw_pocket_options': 0,
'draw_default_options': 0,
'draw_bridges_options': 1,
'draw_skin': 1,
'draw_array': 1,
'draw_cutout_type': 0,
'draw_overshoot': 1,
'draw_startpoint': 1,
'draw_lead_in_out': 3,
'draw_outlines': 2,
'draw_merge': 2
}
# Displays percentage of the cutter which is engaged with the material
# Displays a warning for engagements greater than 50%
def EngagementDisplay(self, operat, layout):
ao = operat
def draw_cutter_engagement(self):
if not self.has_correct_level(): return
if ao.cutter_type == 'BALLCONE':
if ao.dist_between_paths > ao.ball_radius:
layout.label(text="CAUTION: CUTTER ENGAGEMENT")
layout.label(text="GREATER THAN 50%")
layout.label(text="Cutter engagement: " + str(round(100 * ao.dist_between_paths / ao.ball_radius, 1)) + "%")
if self.op.cutter_type in ['BALLCONE']:
engagement = round(100 * self.op.dist_between_paths / self.op.ball_radius, 1)
else:
if ao.dist_between_paths > ao.cutter_diameter / 2:
layout.label(text="CAUTION: CUTTER ENGAGEMENT")
layout.label(text="GREATER THAN 50%")
layout.label(text="Cutter Engagement: " + str(round(100 * ao.dist_between_paths / ao.cutter_diameter, 1)) + "%")
engagement = round(100 * self.op.dist_between_paths / self.op.cutter_diameter, 1)
if engagement > 50:
self.layout.label(text="Warning: High cutter engagement")
self.layout.label(text=f"Cutter engagement: {engagement}%")
def draw_machine_axis(self):
if not self.has_correct_level(): return
self.layout.prop(self.op, 'machine_axes')
def draw_strategy(self):
if not self.has_correct_level(): return
if self.op.machine_axes == '4':
self.layout.prop(self.op, 'strategy4axis')
if self.op.strategy4axis == 'INDEXED':
self.layout.prop(self.op, 'strategy')
self.layout.prop(self.op, 'rotary_axis_1')
elif self.op.machine_axes == '5':
self.layout.prop(self.op, 'strategy5axis')
if self.op.strategy5axis == 'INDEXED':
self.layout.prop(self.op, 'strategy')
self.layout.prop(self.op, 'rotary_axis_1')
self.layout.prop(self.op, 'rotary_axis_2')
else:
self.layout.prop(self.op, 'strategy')
def draw_enable_A_B_axis(self):
if not self.has_correct_level(): return
self.layout.prop(self.op, 'enable_A')
if self.op.enable_A:
self.layout.prop(self.op, 'rotation_A')
self.layout.prop(self.op, 'A_along_x')
if self.op.A_along_x:
self.layout.label(text='A || X - B || Y')
else:
self.layout.label(text='A || Y - B ||X')
self.layout.prop(self.op, 'enable_B')
if self.op.enable_B:
self.layout.prop(self.op, 'rotation_B')
def draw_cutout_type(self):
if not self.has_correct_level(): return
self.layout.prop(self.op, 'cut_type')
def draw_overshoot(self):
if not self.has_correct_level(): return
self.layout.prop(self.op, 'straight')
def draw_startpoint(self):
if not self.has_correct_level(): return
self.layout.prop(self.op, 'profile_start')
def draw_lead_in_out(self):
if not self.has_correct_level(): return
self.layout.prop(self.op, 'lead_in')
self.layout.prop(self.op, 'lead_out')
def draw_outlines(self):
if not self.has_correct_level(): return
self.layout.prop(self.op, 'outlines_count')
if self.op.outlines_count > 1:
self.layout.prop(self.op, 'dist_between_paths')
self.draw_cutter_engagement()
self.layout.prop(self.op.movement, 'insideout')
def draw_merge(self):
if not self.has_correct_level(): return
self.layout.prop(self.op, 'dont_merge')
def draw_cutout_options(self):
if not self.has_correct_level(): return
if self.op.strategy in ['CUTOUT']:
self.draw_cutout_type()
self.draw_overshoot()
self.draw_startpoint()
self.draw_lead_in_out()
if self.op.strategy in ['CUTOUT', 'CURVE']:
self.draw_enable_A_B_axis()
self.draw_outlines()
self.draw_merge()
def draw_waterline_options(self):
if not self.has_correct_level(): return
if self.op.strategy in ['WATERLINE']:
self.layout.label(text="OCL doesn't support fill areas")
if not self.op.optimisation.use_opencamlib:
self.layout.prop(self.op, 'slice_detail')
self.layout.prop(self.op, 'waterline_fill')
if self.op.waterline_fill:
self.layout.prop(self.op, 'dist_between_paths')
self.layout.prop(self.op, 'waterline_project')
self.layout.label(text="Waterline needs a skin margin")
def draw_carve_options(self):
if not self.has_correct_level(): return
if self.op.strategy in ['CARVE']:
self.layout.prop(self.op, 'carve_depth')
self.layout.prop(self.op, 'dist_along_paths')
def draw_medial_axis_options(self):
if not self.has_correct_level(): return
if self.op.strategy in ['MEDIAL_AXIS']:
self.layout.prop(self.op, 'medial_axis_threshold')
self.layout.prop(self.op, 'medial_axis_subdivision')
self.layout.prop(self.op, 'add_pocket_for_medial')
self.layout.prop(self.op, 'add_mesh_for_medial')
def draw_drill_options(self):
if not self.has_correct_level(): return
if self.op.strategy in ['DRILL']:
self.layout.prop(self.op, 'drill_type')
self.draw_enable_A_B_axis()
def draw_pocket_options(self):
if not self.has_correct_level(): return
if self.op.strategy in ['POCKET']:
self.layout.prop(self.op, 'pocket_option')
self.layout.prop(self.op, 'pocketToCurve')
self.layout.prop(self.op, 'dist_between_paths')
self.draw_cutter_engagement()
self.draw_enable_A_B_axis()
def draw_default_options(self):
if not self.has_correct_level(): return
if self.op.strategy not in ['CUTOUT', 'CURVE', 'WATERLINE', 'CARVE', 'MEDIAL_AXIS', 'DRILL', 'POCKET']:
self.layout.prop(self.op, 'dist_between_paths')
self.draw_cutter_engagement()
self.layout.prop(self.op, 'dist_along_paths')
if self.op.strategy in ['PARALLEL','CROSS']:
self.layout.prop(self.op, 'parallel_angle')
self.draw_enable_A_B_axis()
self.layout.prop(self.op, 'inverse')
def draw_bridges_options(self):
if not self.has_correct_level(): return
if self.op.strategy not in ['POCKET', 'DRILL', 'CURVE', 'MEDIAL_AXIS']:
self.layout.prop(self.op, 'use_bridges')
if self.op.use_bridges:
self.layout.prop(self.op, 'bridges_width')
self.layout.prop(self.op, 'bridges_height')
self.layout.prop_search(self.op, "bridges_collection_name", bpy.data, "collections")
self.layout.prop(self.op, 'use_bridge_modifiers')
self.layout.operator("scene.cam_bridges_add", text="Autogenerate bridges")
def draw_skin(self):
if not self.has_correct_level(): return
self.layout.prop(self.op, 'skin')
def draw_array(self):
if not self.has_correct_level(): return
if self.op.machine_axes == '3':
self.layout.prop(self.op, 'array')
if self.op.array:
self.layout.prop(self.op, 'array_x_count')
self.layout.prop(self.op, 'array_x_distance')
self.layout.prop(self.op, 'array_y_count')
self.layout.prop(self.op, 'array_y_distance')
def draw(self, context):
layout = self.layout
scene = bpy.context.scene
self.context = context
if len(scene.cam_operations) == 0:
layout.label(text='Add operation first')
if len(scene.cam_operations) > 0:
ao = scene.cam_operations[scene.cam_active_operation]
if ao.valid:
if self.use_experimental:
layout.prop(ao, 'machine_axes')
if ao.machine_axes == '3':
layout.prop(ao, 'strategy')
elif ao.machine_axes == '4':
layout.prop(ao, 'strategy4axis')
if ao.strategy4axis == 'INDEXED':
layout.prop(ao, 'strategy')
layout.prop(ao, 'rotary_axis_1')
self.draw_machine_axis()
self.draw_strategy()
elif ao.machine_axes == '5':
layout.prop(ao, 'strategy5axis')
if ao.strategy5axis == 'INDEXED':
layout.prop(ao, 'strategy')
layout.prop(ao, 'rotary_axis_1')
layout.prop(ao, 'rotary_axis_2')
self.draw_cutout_options()
self.draw_waterline_options()
self.draw_carve_options()
self.draw_medial_axis_options()
self.draw_drill_options()
self.draw_pocket_options()
self.draw_default_options()
if ao.strategy in ['BLOCK', 'SPIRAL', 'CIRCLES', 'OUTLINEFILL']:
layout.prop(ao.movement, 'insideout')
if ao.strategy in ['CUTOUT', 'CURVE']:
if ao.strategy == 'CUTOUT':
layout.prop(ao, 'cut_type')
layout.label(text="Overshoot works best with curve")
layout.label(text="having C remove doubles")
layout.prop(ao, 'straight')
layout.prop(ao, 'profile_start')
layout.label(text="Lead in / out not fully working")
layout.prop(ao, 'lead_in')
layout.prop(ao, 'lead_out')
layout.prop(ao, 'enable_A')
if ao.enable_A:
layout.prop(ao, 'rotation_A')
layout.prop(ao, 'A_along_x')
if ao.A_along_x:
layout.label(text='A || X - B || Y')
else:
layout.label(text='A || Y - B ||X')
layout.prop(ao, 'enable_B')
if ao.enable_B:
layout.prop(ao, 'rotation_B')
layout.prop(ao, 'outlines_count')
if ao.outlines_count > 1:
layout.prop(ao, 'dist_between_paths')
self.EngagementDisplay(ao, layout)
layout.prop(ao.movement, 'insideout')
layout.prop(ao, 'dont_merge')
elif ao.strategy == 'WATERLINE':
layout.label(text="OCL doesn't support fill areas")
if not ao.optimisation.use_opencamlib:
layout.prop(ao, 'slice_detail')
layout.prop(ao, 'waterline_fill')
if ao.waterline_fill:
layout.prop(ao, 'dist_between_paths')
self.EngagementDisplay(ao, layout)
layout.prop(ao, 'waterline_project')
elif ao.strategy == 'CARVE':
layout.prop(ao, 'carve_depth')
layout.prop(ao, 'dist_along_paths')
elif ao.strategy == 'MEDIAL_AXIS':
layout.prop(ao, 'medial_axis_threshold')
layout.prop(ao, 'medial_axis_subdivision')
layout.prop(ao, 'add_pocket_for_medial')
layout.prop(ao, 'add_mesh_for_medial')
elif ao.strategy == 'DRILL':
layout.prop(ao, 'drill_type')
layout.prop(ao, 'enable_A')
if ao.enable_A:
layout.prop(ao, 'rotation_A')
layout.prop(ao, 'A_along_x')
if ao.A_along_x:
layout.label(text='A || X - B || Y')
else:
layout.label(text='A || Y - B ||X')
layout.prop(ao, 'enable_B')
if ao.enable_B:
layout.prop(ao, 'rotation_B')
elif ao.strategy == 'POCKET':
layout.prop(ao, 'pocket_option')
layout.prop(ao, 'pocketToCurve')
layout.prop(ao, 'dist_between_paths')
self.EngagementDisplay(ao, layout)
layout.prop(ao, 'enable_A')
if ao.enable_A:
layout.prop(ao, 'rotation_A')
layout.prop(ao, 'A_along_x')
if ao.A_along_x:
layout.label(text='A || X - B || Y')
else:
layout.label(text='A || Y - B ||X')
layout.prop(ao, 'enable_B')
if ao.enable_B:
layout.prop(ao, 'rotation_B')
else:
layout.prop(ao, 'dist_between_paths')
self.EngagementDisplay(ao, layout)
layout.prop(ao, 'dist_along_paths')
if ao.strategy == 'PARALLEL' or ao.strategy == 'CROSS':
layout.prop(ao, 'parallel_angle')
layout.prop(ao, 'enable_A')
if ao.enable_A:
layout.prop(ao, 'rotation_A')
layout.prop(ao, 'A_along_x')
if ao.A_along_x:
layout.label(text='A || X - B || Y')
else:
layout.label(text='A || Y - B ||X')
layout.prop(ao, 'enable_B')
if ao.enable_B:
layout.prop(ao, 'rotation_B')
layout.prop(ao, 'inverse')
if ao.strategy not in ['POCKET', 'DRILL', 'CURVE', 'MEDIAL_AXIS']:
layout.prop(ao, 'use_bridges')
if ao.use_bridges:
layout.prop(ao, 'bridges_width')
layout.prop(ao, 'bridges_height')
layout.prop_search(ao, "bridges_collection_name", bpy.data, "collections")
layout.prop(ao, 'use_bridge_modifiers')
layout.operator("scene.cam_bridges_add", text="Autogenerate bridges")
if ao.strategy == 'WATERLINE':
layout.label(text="Waterline roughing strategy")
layout.label(text="needs a skin margin")
layout.prop(ao, 'skin')
if ao.machine_axes == '3':
layout.prop(ao, 'array')
if ao.array:
layout.prop(ao, 'array_x_count')
layout.prop(ao, 'array_x_distance')
layout.prop(ao, 'array_y_count')
layout.prop(ao, 'array_y_distance')
self.draw_bridges_options()
self.draw_skin()
self.draw_array()

Wyświetl plik

@ -11,34 +11,23 @@ from cam.ui_panels.buttons_panel import CAMButtonsPanel
#
# For each operation, generate the corresponding gcode and export the gcode file
class CAM_OPERATIONS_Panel(CAMButtonsPanel, bpy.types.Panel):
"""CAM operations panel"""
bl_label = "CAM operations"
bl_idname = "WORLD_PT_CAM_OPERATIONS"
always_show_panel = True
panel_interface_level = 0
COMPAT_ENGINES = {'BLENDERCAM_RENDER'}
# Main draw function
def draw(self, context):
self.draw_operations_list()
if (not self.has_operations()): return
if self.op is None: return
self.draw_presets()
self.draw_output_buttons()
sub = self.layout.column()
sub.active = not self.op.computing
# Draw operation name and filename
sub.prop(self.op, 'name')
sub.prop(self.op, 'filename')
self.draw_operation_source()
self.draw_operation_options()
prop_level = {
'draw_presets': 1,
'draw_operations_list': 0,
'draw_calculate_path': 0,
'draw_export_gcode': 1,
'draw_simulate_op': 1,
'draw_op_name': 1,
'draw_op_filename': 0,
'draw_operation_source': 0
}
# Draw the list of operations and the associated buttons:
# create, delete, duplicate, reorder
@ -56,37 +45,47 @@ class CAM_OPERATIONS_Panel(CAMButtonsPanel, bpy.types.Panel):
# Draw the list of preset operations, and preset add and remove buttons
def draw_presets(self):
if not self.has_correct_level(): return
row = self.layout.row(align=True)
row.menu("CAM_OPERATION_MT_presets", text=bpy.types.CAM_OPERATION_MT_presets.bl_label)
row.operator("render.cam_preset_operation_add", text="", icon='ADD')
row.operator("render.cam_preset_operation_add", text="", icon='REMOVE').remove_active = True
# Draw buttons "Calculate path & export Gcode", "Export Gcode ", and "Simulate this operation"
def draw_output_buttons(self):
# FIXME This does not seem to work - there is never a "Computing" label displayed
# while an operation is being calculated
if self.op.computing:
row = self.layout.row(align=True)
row.label(text='computing')
row.operator('object.kill_calculate_cam_paths_background', text="", icon='CANCEL')
def draw_calculate_path(self):
if not self.has_correct_level(): return
if self.op.valid:
self.layout.operator("object.calculate_cam_path", text="Calculate path & export Gcode")
else:
if self.op.valid:
self.layout.operator("object.calculate_cam_path", text="Calculate path & export Gcode")
if self.op.name is not None:
name = "cam_path_{}".format(self.op.name)
if bpy.context.scene.objects.get(name) is not None:
self.layout.operator("object.cam_export", text="Export Gcode ")
self.layout.operator("object.cam_simulate", text="Simulate this operation")
else:
self.layout.label(text="operation invalid, can't compute")
self.layout.label(text="operation invalid, can't compute")
def draw_export_gcode(self):
if not self.has_correct_level(): return
if self.op.valid:
if self.op.name is not None:
name = f"cam_path_{self.op.name}"
if bpy.context.scene.objects.get(name) is not None:
self.layout.operator("object.cam_export", text="Export Gcode ")
def draw_simulate_op(self):
if not self.has_correct_level(): return
if self.op.valid:
self.layout.operator("object.cam_simulate", text="Simulate this operation")
def draw_op_name(self):
if not self.has_correct_level(): return
self.layout.prop(self.op, 'name')
def draw_op_filename(self):
if not self.has_correct_level(): return
self.layout.prop(self.op, 'filename')
# Draw a list of objects which will be used as the source of the operation
# FIXME Right now, cameras or lights may be used, which crashes
# The user should only be able to choose meshes and curves
def draw_operation_source(self):
if not self.has_correct_level(): return
self.layout.prop(self.op, 'geometry_source')
if self.op.strategy == 'CURVE':
@ -112,25 +111,21 @@ class CAM_OPERATIONS_Panel(CAMButtonsPanel, bpy.types.Panel):
if self.op.strategy == 'PROJECTED_CURVE':
self.layout.prop_search(self.op, "curve_object1", bpy.data, "objects")
# Draw Operation options:
# Remove redundant points (optimizes operation)
# Use modifiers of the object
# Hide all other paths
# Parent path to object (?)
def draw_operation_options(self):
# TODO This should be in some optimization menu
if self.op.strategy != 'DRILL':
self.layout.prop(self.op, 'remove_redundant_points')
def draw(self, context):
self.context = context
self.draw_presets()
self.draw_operations_list()
if self.op is None: return
self.draw_calculate_path()
self.draw_export_gcode()
self.draw_simulate_op()
self.draw_op_name()
self.draw_op_filename()
self.draw_operation_source()
if self.op.remove_redundant_points:
self.layout.label(text='Revise your Code before running!')
self.layout.label(text='Quality will suffer if tolerance')
self.layout.label(text='is high')
self.layout.prop(self.op, 'simplify_tol')
if self.op.geometry_source in ['OBJECT', 'COLLECTION']:
self.layout.prop(self.op, 'use_modifiers')
self.layout.prop(self.op, 'hide_all_others')
self.layout.prop(self.op, 'parent_path_to_object')

Wyświetl plik

@ -51,37 +51,18 @@ class CAM_OPTIMISATION_Panel(CAMButtonsPanel, bpy.types.Panel):
"""CAM optimisation panel"""
bl_label = "CAM optimisation"
bl_idname = "WORLD_PT_CAM_OPTIMISATION"
panel_interface_level = 2
COMPAT_ENGINES = {'BLENDERCAM_RENDER'}
def draw(self, context):
if self.op is None:
return
if not self.op.valid:
return
self.draw_optimize()
self.layout.separator()
self.draw_exact_mode()
self.draw_use_opencamlib()
self.layout.separator()
self.draw_simulation_detail()
def draw_optimize(self):
if self.op is None:
return
if not self.op.valid:
return
if not self.has_correct_level(): return
self.layout.prop(self.op.optimisation, 'optimize')
if self.op.optimisation.optimize:
self.layout.prop(self.op.optimisation, 'optimize_threshold')
def draw_exact_mode(self):
if self.op is None:
return
if not self.op.valid:
return
if not self.has_correct_level(): return
if not self.op.geometry_source == 'OBJECT' or self.op.geometry_source == 'COLLECTION':
return
@ -106,10 +87,8 @@ class CAM_OPTIMISATION_Panel(CAMButtonsPanel, bpy.types.Panel):
self.layout.label(text=resolution)
def draw_use_opencamlib(self):
if self.op is None:
return
if not self.op.valid:
return
if not self.has_correct_level(): return
if not (self.exact_possible and self.op.optimisation.use_exact):
return
@ -122,10 +101,44 @@ class CAM_OPTIMISATION_Panel(CAMButtonsPanel, bpy.types.Panel):
self.layout.prop(self.op.optimisation, 'use_opencamlib')
def draw_simulation_detail(self):
if self.op is None:
return
if not self.op.valid:
return
if not self.has_correct_level(): return
self.layout.prop(self.op.optimisation, 'simulation_detail')
self.layout.prop(self.op.optimisation, 'circle_detail')
def draw_simplify_gcode(self):
if not self.has_correct_level(): return
if self.op.strategy not in ['DRILL']:
self.layout.prop(self.op, 'remove_redundant_points')
if self.op.remove_redundant_points:
self.layout.prop(self.op, 'simplify_tol')
def draw_use_modifiers(self):
if not self.has_correct_level(): return
if self.op.geometry_source in ['OBJECT', 'COLLECTION']:
self.layout.prop(self.op, 'use_modifiers')
def draw_hide_all_others(self):
if not self.has_correct_level(): return
self.layout.prop(self.op, 'hide_all_others')
def draw_parent_path_to_object(self):
if not self.has_correct_level(): return
self.layout.prop(self.op, 'parent_path_to_object')
def draw(self, context):
self.context = context
self.draw_optimize()
self.layout.separator()
self.draw_exact_mode()
self.draw_use_opencamlib()
self.layout.separator()
self.draw_simulation_detail()
self.draw_simplify_gcode()
self.draw_use_modifiers()
self.draw_hide_all_others()
self.draw_parent_path_to_object()

Wyświetl plik

@ -0,0 +1,29 @@
import bpy
from cam.ui_panels.buttons_panel import CAMButtonsPanel
class CAM_PACK_Panel(CAMButtonsPanel, bpy.types.Panel):
"""CAM material panel"""
bl_label = "Pack curves on sheet"
bl_idname = "WORLD_PT_CAM_PACK"
panel_interface_level = 2
COMPAT_ENGINES = {'BLENDERCAM_RENDER'}
def draw(self, context):
layout = self.layout
scene = bpy.context.scene
settings = scene.cam_pack
layout.label(text='warning - algorithm is slow.')
layout.label(text='only for curves now.')
layout.operator("object.cam_pack_objects")
layout.prop(settings, 'sheet_fill_direction')
layout.prop(settings, 'sheet_x')
layout.prop(settings, 'sheet_y')
layout.prop(settings, 'distance')
layout.prop(settings, 'tolerance')
layout.prop(settings, 'rotate')
if settings.rotate:
layout.prop(settings, 'rotate_angle')

Wyświetl plik

@ -0,0 +1,24 @@
import bpy
from cam.ui_panels.buttons_panel import CAMButtonsPanel
class CAM_SLICE_Panel(CAMButtonsPanel, bpy.types.Panel):
"""CAM slicer panel"""
bl_label = "Slice model to plywood sheets"
bl_idname = "WORLD_PT_CAM_SLICE"
panel_interface_level = 2
COMPAT_ENGINES = {'BLENDERCAM_RENDER'}
def draw(self, context):
layout = self.layout
scene = bpy.context.scene
settings = scene.cam_slice
layout.operator("object.cam_slice_objects")
layout.prop(settings, 'slice_distance')
layout.prop(settings, 'slice_above0')
layout.prop(settings, 'slice_3d')
layout.prop(settings, 'indexes')