├── .gitignore ├── LICENSE ├── README.md ├── archimesh ├── README.md ├── archimesh_0_1.zip └── src │ ├── __init__.py │ ├── column_maker.py │ ├── door_maker.py │ ├── roof_maker.py │ ├── room_maker.py │ ├── stairs_maker.py │ └── tools.py └── doc_scenes ├── Doc_scenes_userguide.pdf ├── doc_scenes_0.2.zip ├── src ├── __init__.py └── html_maker.py └── template ├── doc_template.htm └── images ├── bottom_area.png ├── c.gif ├── doc_style.css ├── mid_area.png ├── top_area.png └── whitenoise.png /.gitignore: -------------------------------------------------------------------------------- 1 | *.py[cod] 2 | 3 | # C extensions 4 | *.so 5 | 6 | # Packages 7 | *.egg 8 | *.egg-info 9 | dist 10 | build 11 | eggs 12 | parts 13 | bin 14 | var 15 | sdist 16 | develop-eggs 17 | .installed.cfg 18 | lib 19 | lib64 20 | __pycache__ 21 | 22 | # Installer logs 23 | pip-log.txt 24 | 25 | # Unit test / coverage reports 26 | .coverage 27 | .tox 28 | nosetests.xml 29 | 30 | # Translations 31 | *.mo 32 | 33 | # Mr Developer 34 | .mr.developer.cfg 35 | .project 36 | .pydevproject 37 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | Blender addons 294 | Copyright (C) 2013 Antonioya 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | {signature of Ty Coon}, 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | blender 2 | ======= 3 | 4 | Blender addons 5 | -------------------------------------------------------------------------------- /archimesh/README.md: -------------------------------------------------------------------------------- 1 | Archimesh 2 | ======= 3 | 4 | Blender addon for creating architecture elements. 5 | 6 | - Rooms 7 | - Houses 8 | - Columns 9 | - Stairs 10 | - Doors 11 | - Tile roofs 12 | -------------------------------------------------------------------------------- /archimesh/archimesh_0_1.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WhaleCodeObi/blender/7fff54584623371053d860468a35c713b94ec3dd/archimesh/archimesh_0_1.zip -------------------------------------------------------------------------------- /archimesh/src/__init__.py: -------------------------------------------------------------------------------- 1 | # ***** BEGIN GPL LICENSE BLOCK ***** 2 | # 3 | # 4 | # This program is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU General Public License 6 | # as published by the Free Software Foundation; either version 2 7 | # of the License, or (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software Foundation, 16 | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | # 18 | # ***** END GPL LICENCE BLOCK ***** 19 | 20 | 21 | #---------------------------------------------------------- 22 | # File: __init__.py 23 | # Author: Antonio Vazquez (antonioya) 24 | #---------------------------------------------------------- 25 | 26 | #---------------------------------------------- 27 | # Define Addon info 28 | #---------------------------------------------- 29 | bl_info = { 30 | "name": "Archimesh", 31 | "author": "Antonio Vazquez (antonioya)", 32 | "location": "View3D > Add > Mesh > Archimesh", 33 | "version": (0, 1), 34 | "blender": (2, 6, 8), 35 | "description": "Generate rooms, door, roofs, stairs and other architecture stuff automatically.", 36 | "category": "Add Mesh"} 37 | 38 | import sys,os 39 | 40 | #---------------------------------------------- 41 | # Add to Phyton path (once only) 42 | #---------------------------------------------- 43 | path = sys.path 44 | flag = False 45 | for item in path: 46 | if "archimesh" in item: 47 | flag = True 48 | if flag == False: 49 | sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'archimesh')) 50 | print("archimesh: added to phytonpath") 51 | 52 | #---------------------------------------------- 53 | # Import modules 54 | #---------------------------------------------- 55 | if "bpy" in locals(): 56 | import imp 57 | imp.reload(room_maker) 58 | imp.reload(door_maker) 59 | imp.reload(roof_maker) 60 | imp.reload(column_maker) 61 | imp.reload(stairs_maker) 62 | print("archimesh: Reloaded multifiles") 63 | else: 64 | from . import room_maker, door_maker,roof_maker,column_maker,stairs_maker 65 | print("archimesh: Imported multifiles") 66 | 67 | import bpy 68 | from bpy.props import * 69 | 70 | #------------------------------------------------------------------ 71 | # Define UI class 72 | # Rooms 73 | #------------------------------------------------------------------ 74 | class ROOM(bpy.types.Operator): 75 | bl_idname = "mesh.archimesh_room" 76 | bl_label = "Room" 77 | bl_description = "Room Generator" 78 | bl_options = {'REGISTER', 'UNDO'} 79 | 80 | # Define properties 81 | room_height=FloatProperty(name='Height',min=0.001,max= 20, default= 2.4,precision=3, description='Room height') 82 | wall_width=FloatProperty(name='Thickness',min=0.000,max= 1, default= 0.0,precision=3, description='Thickness of the walls') 83 | inverse = bpy.props.BoolProperty(name = "Inverse",description="Inverse normals to outside.",default = False) 84 | crt_mat = bpy.props.BoolProperty(name = "Create default Cycles materials",description="Create default materials for Cycles render.",default = True) 85 | 86 | wall_num=IntProperty(name='Number of Walls',min=1,max= 20, default= 1, description='Number total of walls in the room') 87 | 88 | baseboard = bpy.props.BoolProperty(name = "Create baseboard",description="Create a baseboard automatically.",default = True) 89 | base_width=FloatProperty(name='Width',min=0.001,max= 0.50, default= 0.015,precision=3, description='Baseboard width') 90 | base_height=FloatProperty(name='Height',min=0.05,max= 20, default= 0.12,precision=3, description='Baseboard height') 91 | 92 | ceiling = bpy.props.BoolProperty(name = "Ceiling",description="Create a ceiling.",default = False) 93 | floor = bpy.props.BoolProperty(name = "Floor",description="Create a floor automatically.",default = False) 94 | 95 | merge = bpy.props.BoolProperty(name = "Close walls",description="Close walls to create a full closed room.",default = False) 96 | 97 | w01=FloatProperty(name='Wall 01 size',min=-50,max= 50, default= 1,precision=3, description='Length of the wall (negative to reverse direction)') 98 | w02=FloatProperty(name='Wall 02 size',min=-50,max= 50, default= 1,precision=3, description='Length of the wall (negative to reverse direction)') 99 | w03=FloatProperty(name='Wall 03 size',min=-50,max= 50, default= 1,precision=3, description='Length of the wall (negative to reverse direction)') 100 | w04=FloatProperty(name='Wall 04 size',min=-50,max= 50, default= 1,precision=3, description='Length of the wall (negative to reverse direction)') 101 | w05=FloatProperty(name='Wall 05 size',min=-50,max= 50, default= 1,precision=3, description='Length of the wall (negative to reverse direction)') 102 | w06=FloatProperty(name='Wall 06 size',min=-50,max= 50, default= 1,precision=3, description='Length of the wall (negative to reverse direction)') 103 | w07=FloatProperty(name='Wall 07 size',min=-50,max= 50, default= 1,precision=3, description='Length of the wall (negative to reverse direction)') 104 | w08=FloatProperty(name='Wall 08 size',min=-50,max= 50, default= 1,precision=3, description='Length of the wall (negative to reverse direction)') 105 | w09=FloatProperty(name='Wall 09 size',min=-50,max= 50, default= 1,precision=3, description='Length of the wall (negative to reverse direction)') 106 | w10=FloatProperty(name='Wall 10 size',min=-50,max= 50, default= 1,precision=3, description='Length of the wall (negative to reverse direction)') 107 | w11=FloatProperty(name='Wall 11 size',min=-50,max= 50, default= 1,precision=3, description='Length of the wall (negative to reverse direction)') 108 | w12=FloatProperty(name='Wall 12 size',min=-50,max= 50, default= 1,precision=3, description='Length of the wall (negative to reverse direction)') 109 | w13=FloatProperty(name='Wall 13 size',min=-50,max= 50, default= 1,precision=3, description='Length of the wall (negative to reverse direction)') 110 | w14=FloatProperty(name='Wall 14 size',min=-50,max= 50, default= 1,precision=3, description='Length of the wall (negative to reverse direction)') 111 | w15=FloatProperty(name='Wall 15 size',min=-50,max= 50, default= 1,precision=3, description='Length of the wall (negative to reverse direction)') 112 | w16=FloatProperty(name='Wall 16 size',min=-50,max= 50, default= 1,precision=3, description='Length of the wall (negative to reverse direction)') 113 | w17=FloatProperty(name='Wall 17 size',min=-50,max= 50, default= 1,precision=3, description='Length of the wall (negative to reverse direction)') 114 | w18=FloatProperty(name='Wall 18 size',min=-50,max= 50, default= 1,precision=3, description='Length of the wall (negative to reverse direction)') 115 | w19=FloatProperty(name='Wall 19 size',min=-50,max= 50, default= 1,precision=3, description='Length of the wall (negative to reverse direction)') 116 | w20=FloatProperty(name='Wall 20 size',min=-50,max= 50, default= 1,precision=3, description='Length of the wall (negative to reverse direction)') 117 | 118 | a01 = bpy.props.BoolProperty(name = "Advanced",description="Advance options.",default = False) 119 | m01=FloatProperty(name='',min=0,max= 50, default= 0,precision=3, description='Middle height variation') 120 | f01=FloatProperty(name='',min=-1,max= 1, default= 0,precision=3, description='Middle displacement') 121 | 122 | a02 = bpy.props.BoolProperty(name = "Advanced",description="Advance options.",default = False) 123 | m02=FloatProperty(name='',min=0,max= 50, default= 0,precision=3, description='Middle height variation') 124 | f02=FloatProperty(name='',min=-1,max= 1, default= 0,precision=3, description='Middle displacement') 125 | 126 | a03 = bpy.props.BoolProperty(name = "Advanced",description="Advance options.",default = False) 127 | m03=FloatProperty(name='',min=0,max= 50, default= 0,precision=3, description='Middle height variation') 128 | f03=FloatProperty(name='',min=-1,max= 1, default= 0,precision=3, description='Middle displacement') 129 | 130 | a04 = bpy.props.BoolProperty(name = "Advanced",description="Advance options.",default = False) 131 | m04=FloatProperty(name='',min=0,max= 50, default= 0,precision=3, description='Middle height variation') 132 | f04=FloatProperty(name='',min=-1,max= 1, default= 0,precision=3, description='Middle displacement') 133 | 134 | a05 = bpy.props.BoolProperty(name = "Advanced",description="Advance options.",default = False) 135 | m05=FloatProperty(name='',min=0,max= 50, default= 0,precision=3, description='Middle height variation') 136 | f05=FloatProperty(name='',min=-1,max= 1, default= 0,precision=3, description='Middle displacement') 137 | 138 | a06 = bpy.props.BoolProperty(name = "Advanced",description="Advance options.",default = False) 139 | m06=FloatProperty(name='',min=0,max= 50, default= 0,precision=3, description='Middle height variation') 140 | f06=FloatProperty(name='',min=-1,max= 1, default= 0,precision=3, description='Middle displacement') 141 | 142 | a07 = bpy.props.BoolProperty(name = "Advanced",description="Advance options.",default = False) 143 | m07=FloatProperty(name='',min=0,max= 50, default= 0,precision=3, description='Middle height variation') 144 | f07=FloatProperty(name='',min=-1,max= 1, default= 0,precision=3, description='Middle displacement') 145 | 146 | a08 = bpy.props.BoolProperty(name = "Advanced",description="Advance options.",default = False) 147 | m08=FloatProperty(name='',min=0,max= 50, default= 0,precision=3, description='Middle height variation') 148 | f08=FloatProperty(name='',min=-1,max= 1, default= 0,precision=3, description='Middle displacement') 149 | 150 | a09 = bpy.props.BoolProperty(name = "Advanced",description="Advance options.",default = False) 151 | m09=FloatProperty(name='',min=0,max= 50, default= 0,precision=3, description='Middle height variation') 152 | f09=FloatProperty(name='',min=-1,max= 1, default= 0,precision=3, description='Middle displacement') 153 | 154 | a10 = bpy.props.BoolProperty(name = "Advanced",description="Advance options.",default = False) 155 | m10=FloatProperty(name='',min=0,max= 50, default= 0,precision=3, description='Middle height variation') 156 | f10=FloatProperty(name='',min=-1,max= 1, default= 0,precision=3, description='Middle displacement') 157 | 158 | a11 = bpy.props.BoolProperty(name = "Advanced",description="Advance options.",default = False) 159 | m11=FloatProperty(name='',min=0,max= 50, default= 0,precision=3, description='Middle height variation') 160 | f11=FloatProperty(name='',min=-1,max= 1, default= 0,precision=3, description='Middle displacement') 161 | 162 | a12 = bpy.props.BoolProperty(name = "Advanced",description="Advance options.",default = False) 163 | m12=FloatProperty(name='',min=0,max= 50, default= 0,precision=3, description='Middle height variation') 164 | f12=FloatProperty(name='',min=-1,max= 1, default= 0,precision=3, description='Middle displacement') 165 | 166 | a13 = bpy.props.BoolProperty(name = "Advanced",description="Advance options.",default = False) 167 | m13=FloatProperty(name='',min=0,max= 50, default= 0,precision=3, description='Middle height variation') 168 | f13=FloatProperty(name='',min=-1,max= 1, default= 0,precision=3, description='Middle displacement') 169 | 170 | a14 = bpy.props.BoolProperty(name = "Advanced",description="Advance options.",default = False) 171 | m14=FloatProperty(name='',min=0,max= 50, default= 0,precision=3, description='Middle height variation') 172 | f14=FloatProperty(name='',min=-1,max= 1, default= 0,precision=3, description='Middle displacement') 173 | 174 | a15 = bpy.props.BoolProperty(name = "Advanced",description="Advance options.",default = False) 175 | m15=FloatProperty(name='',min=0,max= 50, default= 0,precision=3, description='Middle height variation') 176 | f15=FloatProperty(name='',min=-1,max= 1, default= 0,precision=3, description='Middle displacement') 177 | 178 | a16 = bpy.props.BoolProperty(name = "Advanced",description="Advance options.",default = False) 179 | m16=FloatProperty(name='',min=0,max= 50, default= 0,precision=3, description='Middle height variation') 180 | f16=FloatProperty(name='',min=-1,max= 1, default= 0,precision=3, description='Middle displacement') 181 | 182 | a17 = bpy.props.BoolProperty(name = "Advanced",description="Advance options.",default = False) 183 | m17=FloatProperty(name='',min=0,max= 50, default= 0,precision=3, description='Middle height variation') 184 | f17=FloatProperty(name='',min=-1,max= 1, default= 0,precision=3, description='Middle displacement') 185 | 186 | a18 = bpy.props.BoolProperty(name = "Advanced",description="Advance options.",default = False) 187 | m18=FloatProperty(name='',min=0,max= 50, default= 0,precision=3, description='Middle height variation') 188 | f18=FloatProperty(name='',min=-1,max= 1, default= 0,precision=3, description='Middle displacement') 189 | 190 | a19 = bpy.props.BoolProperty(name = "Advanced",description="Advance options.",default = False) 191 | m19=FloatProperty(name='',min=0,max= 50, default= 0,precision=3, description='Middle height variation') 192 | f19=FloatProperty(name='',min=-1,max= 1, default= 0,precision=3, description='Middle displacement') 193 | 194 | a20 = bpy.props.BoolProperty(name = "Advanced",description="Advance options.",default = False) 195 | m20=FloatProperty(name='',min=0,max= 50, default= 0,precision=3, description='Middle height variation') 196 | f20=FloatProperty(name='',min=-1,max= 1, default= 0,precision=3, description='Middle displacement') 197 | 198 | 199 | #----------------------------------------------------- 200 | # Draw (create UI interface) 201 | #----------------------------------------------------- 202 | def draw(self, context): 203 | layout = self.layout 204 | box=layout.row() 205 | box.prop(self,'room_height') 206 | box.prop(self,'wall_width') 207 | box.prop(self,'inverse') 208 | 209 | row=layout.row() 210 | row.prop(self,'ceiling') 211 | row.prop(self,'floor') 212 | row.prop(self,'merge') 213 | 214 | box=layout.box() 215 | box.prop(self,'wall_num') 216 | if (self.wall_num >= 1): add_wall(self,context,box,self.a01,'01') 217 | if (self.wall_num >= 2): add_wall(self,context,box,self.a02,'02') 218 | if (self.wall_num >= 3): add_wall(self,context,box,self.a03,'03') 219 | if (self.wall_num >= 4): add_wall(self,context,box,self.a04,'04') 220 | if (self.wall_num >= 5): add_wall(self,context,box,self.a05,'05') 221 | if (self.wall_num >= 6): add_wall(self,context,box,self.a06,'06') 222 | if (self.wall_num >= 7): add_wall(self,context,box,self.a07,'07') 223 | if (self.wall_num >= 8): add_wall(self,context,box,self.a08,'08') 224 | if (self.wall_num >= 9): add_wall(self,context,box,self.a09,'09') 225 | if (self.wall_num >= 10): add_wall(self,context,box,self.a10,'10') 226 | if (self.wall_num >= 11): add_wall(self,context,box,self.a11,'11') 227 | if (self.wall_num >= 12): add_wall(self,context,box,self.a12,'12') 228 | if (self.wall_num >= 13): add_wall(self,context,box,self.a13,'13') 229 | if (self.wall_num >= 14): add_wall(self,context,box,self.a14,'14') 230 | if (self.wall_num >= 15): add_wall(self,context,box,self.a15,'15') 231 | if (self.wall_num >= 16): add_wall(self,context,box,self.a16,'16') 232 | if (self.wall_num >= 17): add_wall(self,context,box,self.a17,'17') 233 | if (self.wall_num >= 18): add_wall(self,context,box,self.a18,'18') 234 | if (self.wall_num >= 19): add_wall(self,context,box,self.a19,'19') 235 | if (self.wall_num >= 20): add_wall(self,context,box,self.a20,'20') 236 | 237 | 238 | box=layout.box() 239 | box.prop(self,'baseboard') 240 | if (self.baseboard==True): 241 | row = box.row() 242 | row.prop(self,'base_width') 243 | row.prop(self,'base_height') 244 | 245 | box=layout.box() 246 | box.prop(self,'crt_mat') 247 | 248 | #----------------------------------------------------- 249 | # Execute 250 | #----------------------------------------------------- 251 | def execute(self, context): 252 | room_maker.create_mesh(self,context) 253 | return {'FINISHED'} 254 | 255 | #----------------------------------------------------- 256 | # Add wall parameters 257 | #----------------------------------------------------- 258 | def add_wall(self,context,box,var,num): 259 | row = box.row() 260 | row.prop(self,'w' + num) 261 | row.prop(self,'a' + num) 262 | if (var == True): 263 | srow = row.row() 264 | srow.prop(self,'m' + num) 265 | srow.prop(self,'f' + num) 266 | 267 | 268 | #------------------------------------------------------------------ 269 | # Define UI class 270 | # Rooms 271 | #------------------------------------------------------------------ 272 | class ROOF(bpy.types.Operator): 273 | bl_idname = "mesh.archimesh_roof" 274 | bl_label = "Roof" 275 | bl_description = "Roof Generator" 276 | bl_options = {'REGISTER', 'UNDO'} 277 | 278 | # Define properties 279 | roof_width = IntProperty(name='Num tiles X',min=1,max= 100, default= 6, description='Tiles in X axis') 280 | roof_height = IntProperty(name='Num tiles Y',min=1,max= 100, default= 3, description='Tiles in Y axis') 281 | #roof_base=FloatProperty(name='Base thickness',min=0.002,max= 0.50, default= 0.02,precision=3, description='Thickness of base in the smallets point') 282 | 283 | roof_thick=FloatProperty(name='Tile thickness',min=0.000,max= 0.50, default= 0.012,precision=3, description='Thickness of the roof tile') 284 | roof_angle=FloatProperty(name='Roof slope',min=0.0,max= 70.0, default= 0.0,precision=1, description='Roof angle of slope') 285 | roof_scale=FloatProperty(name='Tile scale',min=0.001,max= 10, default= 1,precision=3, description='Scale of roof tile') 286 | 287 | crt_mat = bpy.props.BoolProperty(name = "Create default Cycles materials",description="Create default materials for Cycles render.",default = True) 288 | 289 | model = EnumProperty(items = (('1',"Model 01",""), 290 | ('2',"Model 02",""), 291 | ('3',"Model 03",""), 292 | ('4',"Model 04","")), 293 | name="Model", 294 | description="Roof tile model") 295 | 296 | #----------------------------------------------------- 297 | # Draw (create UI interface) 298 | #----------------------------------------------------- 299 | def draw(self, context): 300 | layout = self.layout 301 | box=layout.box() 302 | box.prop(self,'model') 303 | box.prop(self,'roof_width') 304 | box.prop(self,'roof_height') 305 | box.prop(self,'roof_scale') 306 | 307 | if (self.model == "1"): 308 | tilesize_x = 0.184 309 | tilesize_y = 0.413 310 | 311 | if (self.model == "2"): 312 | tilesize_x = 0.103 313 | tilesize_y = 0.413 314 | 315 | if (self.model == "3"): 316 | tilesize_x = 0.184 317 | tilesize_y = 0.434 318 | 319 | if (self.model == "4"): 320 | tilesize_x = 0.231 321 | tilesize_y = 0.39 322 | 323 | 324 | x = tilesize_x * self.roof_scale * self.roof_width 325 | y = tilesize_y * self.roof_scale * self.roof_height 326 | 327 | buf = 'Size: {0:.2f} * {1:.2f} aprox.'.format(x,y) 328 | box.label(buf) 329 | 330 | box=layout.box() 331 | box.prop(self,'roof_thick') 332 | box.prop(self,'roof_angle') 333 | 334 | box=layout.box() 335 | box.prop(self,'crt_mat') 336 | 337 | #----------------------------------------------------- 338 | # Execute 339 | #----------------------------------------------------- 340 | def execute(self, context): 341 | roof_maker.create_mesh(self,context) 342 | return {'FINISHED'} 343 | 344 | #------------------------------------------------------------------ 345 | # Define UI class 346 | # Doors 347 | #------------------------------------------------------------------ 348 | class DOOR(bpy.types.Operator): 349 | bl_idname = "mesh.archimesh_door" 350 | bl_label = "Door" 351 | bl_description = "Door Generator" 352 | bl_options = {'REGISTER', 'UNDO'} 353 | 354 | # Define properties 355 | frame_width=FloatProperty(name='Frame width',min=0.25,max= 10, default= 1,precision=2, description='Doorframe width') 356 | frame_height=FloatProperty(name='Frame height',min=0.25,max= 10, default= 2.1,precision=2, description='Doorframe height') 357 | frame_thick=FloatProperty(name='Frame thickness',min=0.05,max= 0.50, default= 0.08,precision=2, description='Doorframe thickness') 358 | frame_size=FloatProperty(name='Frame size',min=0.05,max= 0.25, default= 0.08,precision=2, description='Doorframe size') 359 | crt_mat = bpy.props.BoolProperty(name = "Create default Cycles materials",description="Create default materials for Cycles render.",default = True) 360 | factor=FloatProperty(name='',min=0.2,max= 1, default= 0.5,precision=3, description='Door ratio') 361 | 362 | openside = EnumProperty(items = (('1',"Right open",""), 363 | ('2',"Left open",""), 364 | ('3',"Both sides","")), 365 | name="Open side", 366 | description="Defines the direction for opening the door") 367 | 368 | model = EnumProperty(items = (('1',"Model 01",""), 369 | ('2',"Model 02",""), 370 | ('3',"Model 03",""), 371 | ('4',"Model 04",""), 372 | ('5',"Model 05","Glass"), 373 | ('6',"Model 06","Glass")), 374 | name="Model", 375 | description="Door model") 376 | 377 | handle = EnumProperty(items = (('1',"Handle 01",""), 378 | ('2',"Handle 02",""), 379 | ('3',"Handle 03",""), 380 | ('4',"Handle 04",""), 381 | ('0',"None","")), 382 | name="Handle", 383 | description="Handle model") 384 | 385 | #----------------------------------------------------- 386 | # Draw (create UI interface) 387 | #----------------------------------------------------- 388 | def draw(self, context): 389 | layout = self.layout 390 | box=layout.box() 391 | box.prop(self,'frame_width') 392 | box.prop(self,'frame_height') 393 | box.prop(self,'frame_thick') 394 | box.prop(self,'frame_size') 395 | 396 | box=layout.box() 397 | row=box.row() 398 | row.prop(self,'openside') 399 | if (self.openside == "3"): 400 | row.prop(self,"factor") 401 | 402 | layout.prop(self,'model') 403 | layout.prop(self,'handle') 404 | 405 | box=layout.box() 406 | box.prop(self,'crt_mat') 407 | 408 | #----------------------------------------------------- 409 | # Execute 410 | #----------------------------------------------------- 411 | def execute(self, context): 412 | door_maker.create_mesh(self,context) 413 | return {'FINISHED'} 414 | 415 | #------------------------------------------------------------------ 416 | # Define UI class 417 | # Columns 418 | #------------------------------------------------------------------ 419 | class COLUMN(bpy.types.Operator): 420 | bl_idname = "mesh.archimesh_column" 421 | bl_label = "Column" 422 | bl_description = "Columns Generator" 423 | bl_options = {'REGISTER', 'UNDO'} 424 | 425 | # Define properties 426 | model = EnumProperty(items = (('1',"Circular",""), 427 | ('2',"Rectangular","")), 428 | name="Model", 429 | description="Type of column") 430 | keep_size = bpy.props.BoolProperty(name = "Keep radius equal",description="Keep all radius (top, mid and bottom) to the same size.",default = True) 431 | 432 | rad_top = FloatProperty(name='Top radius',min=0.001,max= 10, default= 0.15,precision=3, description='Radius of the column in the top') 433 | rad_mid = FloatProperty(name='Middle radius',min=0.001,max= 10, default= 0.15,precision=3, description='Radius of the column in the middle') 434 | rad_bottom = FloatProperty(name='Bottom radius',min=0.001,max= 10, default= 0.15,precision=3, description='Radius of the column in the bottom') 435 | 436 | col_height = FloatProperty(name='Total height',min=0.001,max= 10, default= 2.4,precision=3, description='Total height of column, including bases and tops') 437 | col_sx = FloatProperty(name='X size',min=0.001,max= 10, default= 0.30,precision=3, description='Column size for x axis') 438 | col_sy = FloatProperty(name='Y size',min=0.001,max= 10, default= 0.30,precision=3, description='Column size for y axis') 439 | 440 | cir_base = bpy.props.BoolProperty(name = "Include circular base",description="Include a base with circular form.",default = False) 441 | cir_base_r = FloatProperty(name='Radio',min=0.001,max= 10, default= 0.08,precision=3, description='Rise up radio of base') 442 | cir_base_z = FloatProperty(name='Height',min=0.001,max= 10, default= 0.05,precision=3, description='Size for z axis') 443 | 444 | cir_top = bpy.props.BoolProperty(name = "Include circular top",description="Include a top with circular form.",default = False) 445 | cir_top_r = FloatProperty(name='Radio',min=0.001,max= 10, default= 0.08,precision=3, description='Rise up radio of top') 446 | cir_top_z = FloatProperty(name='Height',min=0.001,max= 10, default= 0.05,precision=3, description='Size for z axis') 447 | 448 | box_base = bpy.props.BoolProperty(name = "Include rectangular base",description="Include a base with rectangular form.",default = True) 449 | box_base_x = FloatProperty(name='X size',min=0.001,max= 10, default= 0.40,precision=3, description='Size for x axis') 450 | box_base_y = FloatProperty(name='Y size',min=0.001,max= 10, default= 0.40,precision=3, description='Size for y axis') 451 | box_base_z = FloatProperty(name='Height',min=0.001,max= 10, default= 0.05,precision=3, description='Size for z axis') 452 | 453 | box_top = bpy.props.BoolProperty(name = "Include rectangular top",description="Include a top with rectangular form.",default = True) 454 | box_top_x = FloatProperty(name='X size',min=0.001,max= 10, default= 0.40,precision=3, description='Size for x axis') 455 | box_top_y = FloatProperty(name='Y size',min=0.001,max= 10, default= 0.40,precision=3, description='Size for y axis') 456 | box_top_z = FloatProperty(name='Height',min=0.001,max= 10, default= 0.05,precision=3, description='Size for z axis') 457 | 458 | arc_top = bpy.props.BoolProperty(name = "Create top arch",description="Include an arch in the top of the column.",default = False) 459 | arc_radio = FloatProperty(name='Arc Radio',min=0.001,max= 10, default= 1,precision=1, description='Radio of the arch') 460 | arc_width = FloatProperty(name='Thickness',min=0.01,max= 10, default= 0.15,precision=2, description='Thickness of the arch wall') 461 | arc_gap = FloatProperty(name='Arc gap',min=0.01,max= 10, default= 0.25,precision=2, description='Size of the gap in the arch sides') 462 | 463 | crt_mat = bpy.props.BoolProperty(name = "Create default Cycles materials",description="Create default materials for Cycles render.",default = True) 464 | crt_array = bpy.props.BoolProperty(name = "Create array of elements",description="Create a modifier array for all elemnst.",default = False) 465 | array_num_x = IntProperty(name='Count X',min=0,max= 100, default= 3, description='Number of elements in array') 466 | array_space_x = FloatProperty(name='Distance X',min=0.001,max= 10, default= 1,precision=3, description='Distance between elements (only arc disabled)') 467 | array_num_y = IntProperty(name='Count Y',min=0,max= 100, default= 0, description='Number of elements in array') 468 | array_space_y = FloatProperty(name='Distance Y',min=0.001,max= 10, default= 1,precision=3, description='Distance between elements (only arc disabled)') 469 | array_space_factor = FloatProperty(name='Move Y center',min=0.00,max= 1, default= 0.0,precision=3, description='Move the center of the arch in Y axis. (0 centered)') 470 | 471 | 472 | #----------------------------------------------------- 473 | # Draw (create UI interface) 474 | #----------------------------------------------------- 475 | def draw(self, context): 476 | layout = self.layout 477 | box=layout.box() 478 | box.prop(self,'model') 479 | # Circular 480 | if (self.model == "1"): 481 | box.prop(self,'keep_size') 482 | box.prop(self,'rad_top') 483 | if (self.keep_size == False): 484 | box.prop(self,'rad_mid') 485 | box.prop(self,'rad_bottom') 486 | 487 | # Rectangular 488 | if (self.model == "2"): 489 | box.prop(self,'col_sx') 490 | box.prop(self,'col_sy') 491 | 492 | box.prop(self,'col_height') 493 | 494 | box=layout.box() 495 | box.prop(self,'box_base') 496 | if (self.box_base == True): 497 | box.prop(self,'box_base_x') 498 | box.prop(self,'box_base_y') 499 | box.prop(self,'box_base_z') 500 | 501 | box=layout.box() 502 | box.prop(self,'box_top') 503 | if (self.box_top == True): 504 | box.prop(self,'box_top_x') 505 | box.prop(self,'box_top_y') 506 | box.prop(self,'box_top_z') 507 | 508 | box=layout.box() 509 | box.prop(self,'cir_base') 510 | if (self.cir_base == True): 511 | box.prop(self,'cir_base_r') 512 | box.prop(self,'cir_base_z') 513 | 514 | box=layout.box() 515 | box.prop(self,'cir_top') 516 | if (self.cir_top == True): 517 | box.prop(self,'cir_top_r') 518 | box.prop(self,'cir_top_z') 519 | 520 | box = layout.box() 521 | box.prop(self,'arc_top') 522 | if (self.arc_top == True): 523 | box.prop(self,'arc_radio') 524 | box.prop(self,'arc_gap') 525 | box.prop(self,'arc_width') 526 | box.prop(self,'array_space_factor') 527 | 528 | box = layout.box() 529 | box.prop(self,'crt_array') 530 | if (self.crt_array == True): 531 | row = box.row() 532 | row.prop(self,'array_num_x') 533 | row.prop(self,'array_num_y') 534 | if (self.arc_top == True): 535 | box.label("Use arch radio and thickness to set distances") 536 | 537 | if (self.arc_top == False): 538 | row.prop(self,'array_space_x') 539 | row.prop(self,'array_space_y') 540 | 541 | box = layout.box() 542 | box.prop(self,'crt_mat') 543 | #----------------------------------------------------- 544 | # Execute 545 | #----------------------------------------------------- 546 | def execute(self, context): 547 | column_maker.create_mesh(self,context) 548 | return {'FINISHED'} 549 | 550 | #------------------------------------------------------------------ 551 | # Define UI class 552 | # Stairs 553 | #------------------------------------------------------------------ 554 | class STAIRS(bpy.types.Operator): 555 | bl_idname = "mesh.archimesh_stairs" 556 | bl_label = "Stairs" 557 | bl_description = "Stairs Generator" 558 | bl_options = {'REGISTER', 'UNDO'} 559 | 560 | # Define properties 561 | model = EnumProperty(items = (('1',"Rectangular",""), 562 | ('2',"Rounded","")), 563 | name="Model", 564 | description="Type of steps") 565 | radio = FloatProperty(name='',min=0.001,max= 0.500, default= 0.20,precision=3, description='Radius factor for rounded') 566 | curve = bpy.props.BoolProperty(name = "Include deformation handles",description="Include a curve to modify the stairs curve.",default = False) 567 | 568 | step_num=IntProperty(name='Number of steps',min=1,max= 20, default= 3, description='Number total of steps') 569 | max_width = FloatProperty(name='Width',min=0.001,max= 10, default= 1,precision=3, description='Step maximum width') 570 | depth = FloatProperty(name='Depth',min=0.001,max= 10, default= 0.30,precision=3, description='Depth of the step') 571 | shift = FloatProperty(name='Shift',min=0.001,max= 1, default= 1,precision=3, description='Step shift in Y axis') 572 | thickness = FloatProperty(name='Thickness',min=0.001,max= 10, default= 0.03,precision=3, description='Step thickness') 573 | sizev = bpy.props.BoolProperty(name = "Variable width",description="Steps are not equal in width.",default = False) 574 | back = bpy.props.BoolProperty(name = "Close sides",description="Close all steps side to make a solid structure.",default = False) 575 | min_width = FloatProperty(name='',min=0.001,max= 10, default= 1,precision=3, description='Step minimum width') 576 | 577 | height = FloatProperty(name='height',min=0.001,max= 10, default= 0.14,precision=3, description='Step height') 578 | front_gap = FloatProperty(name='Front',min=0,max= 10, default= 0.03,precision=3, description='Front gap') 579 | side_gap = FloatProperty(name='Side',min=0,max= 10, default= 0,precision=3, description='Side gap') 580 | crt_mat = bpy.props.BoolProperty(name = "Create default Cycles materials",description="Create default materials for Cycles render.",default = True) 581 | 582 | 583 | #----------------------------------------------------- 584 | # Draw (create UI interface) 585 | #----------------------------------------------------- 586 | def draw(self, context): 587 | layout = self.layout 588 | box=layout.box() 589 | row = box.row() 590 | row.prop(self,'model') 591 | if (self.model == "2"): 592 | row.prop(self,'radio') 593 | 594 | box.prop(self,'step_num') 595 | row = box.row() 596 | row.prop(self,'max_width') 597 | row.prop(self,'depth') 598 | row.prop(self,'shift') 599 | row = box.row() 600 | row.prop(self,'back') 601 | row.prop(self,'sizev') 602 | row = box.row() 603 | row.prop(self,'curve') 604 | # all equal 605 | if (self.sizev == True): 606 | row.prop(self,'min_width') 607 | 608 | box=layout.box() 609 | row = box.row() 610 | row.prop(self,'thickness') 611 | row.prop(self,'height') 612 | row = box.row() 613 | row.prop(self,'front_gap') 614 | if (self.model == "1"): 615 | row.prop(self,'side_gap') 616 | 617 | box = layout.box() 618 | box.prop(self,'crt_mat') 619 | #----------------------------------------------------- 620 | # Execute 621 | #----------------------------------------------------- 622 | def execute(self, context): 623 | stairs_maker.create_mesh(self,context) 624 | return {'FINISHED'} 625 | 626 | #---------------------------------------------------------- 627 | # Registration 628 | #---------------------------------------------------------- 629 | class INFO_MT_mesh_custom_menu_add(bpy.types.Menu): 630 | bl_idname = "INFO_MT_mesh_custom_menu_add" 631 | bl_label = "Archimesh" 632 | 633 | def draw(self, context): 634 | layout = self.layout 635 | self.layout.operator("mesh.archimesh_room", text="Add Room",icon="PLUGIN"); 636 | self.layout.operator("mesh.archimesh_door", text="Add Door",icon="PLUGIN") 637 | self.layout.operator("mesh.archimesh_column", text="Add Column",icon="PLUGIN") 638 | self.layout.operator("mesh.archimesh_stairs", text="Add Stairs",icon="PLUGIN") 639 | self.layout.operator("mesh.archimesh_roof", text="Add Roof",icon="PLUGIN") 640 | 641 | 642 | #-------------------------------------------------------------- 643 | # Register all operators and panels 644 | #-------------------------------------------------------------- 645 | # Define menu 646 | def menu_func(self, context): 647 | self.layout.menu("INFO_MT_mesh_custom_menu_add", icon="PLUGIN") 648 | 649 | def register(): 650 | bpy.utils.register_class(INFO_MT_mesh_custom_menu_add) 651 | bpy.utils.register_class(ROOM) 652 | bpy.utils.register_class(DOOR) 653 | bpy.utils.register_class(ROOF) 654 | bpy.utils.register_class(COLUMN) 655 | bpy.utils.register_class(STAIRS) 656 | bpy.types.INFO_MT_mesh_add.append(menu_func) 657 | 658 | def unregister(): 659 | bpy.utils.unregister_class(INFO_MT_mesh_custom_menu_add) 660 | bpy.utils.unregister_class(ROOM) 661 | bpy.utils.unregister_class(DOOR) 662 | bpy.utils.unregister_class(ROOF) 663 | bpy.utils.unregister_class(COLUMN) 664 | bpy.utils.unregister_class(STAIRS) 665 | bpy.types.INFO_MT_mesh_add.remove(menu_func) 666 | 667 | if __name__ == '__main__': 668 | register() 669 | 670 | -------------------------------------------------------------------------------- /archimesh/src/column_maker.py: -------------------------------------------------------------------------------- 1 | # ***** BEGIN GPL LICENSE BLOCK ***** 2 | # 3 | # 4 | # This program is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU General Public License 6 | # as published by the Free Software Foundation; either version 2 7 | # of the License, or (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software Foundation, 16 | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | # 18 | # ***** END GPL LICENCE BLOCK ***** 19 | 20 | #---------------------------------------------------------- 21 | # File: column_maker.py 22 | # Automatic generation of columns 23 | # Author: Antonio Vazquez (antonioya) 24 | # 25 | #---------------------------------------------------------- 26 | import bpy 27 | import mathutils 28 | import math 29 | from tools import * 30 | 31 | #------------------------------------------------------------------------------ 32 | # Generate mesh data 33 | # All custom values are passed using self container (self.myvariable) 34 | #------------------------------------------------------------------------------ 35 | def create_mesh(self,context): 36 | 37 | # deactivate others 38 | for o in bpy.data.objects: 39 | if (o.select == True): 40 | o.select = False 41 | 42 | bpy.ops.object.select_all(False) 43 | 44 | radio_top = self.rad_top 45 | if (self.keep_size == True): 46 | radio_mid = radio_top 47 | radio_bottom = radio_top 48 | else: 49 | radio_mid = self.rad_mid 50 | radio_bottom = self.rad_bottom 51 | 52 | # Calculate height 53 | base_column = 0.0 54 | height = self.col_height 55 | if (self.box_base): 56 | height = height - self.box_base_z 57 | base_column = self.box_base_z 58 | if (self.box_top): 59 | height = height - self.box_top_z 60 | #------------------------ 61 | # Create circular column 62 | #------------------------ 63 | if (self.model == "1"): 64 | bpy.ops.object.select_all(False) 65 | myColumn = create_circular_column(self,context,"Column",radio_top,radio_mid,radio_bottom,height) 66 | myColumn.select = True 67 | bpy.context.scene.objects.active = myColumn 68 | # Subsurf 69 | set_smooth(myColumn) 70 | set_modifier_subsurf(myColumn) 71 | #------------------------ 72 | # Create rectangular column 73 | #------------------------ 74 | if (self.model == "2"): 75 | myColumn = create_rectangular_base(self,context,"Column",self.col_sx,self.col_sy,height) 76 | bpy.ops.object.select_all(False) 77 | myColumn.select = True 78 | bpy.context.scene.objects.active = myColumn 79 | #------------------------ 80 | # Circular base 81 | #------------------------ 82 | if (self.cir_base == True): 83 | cir_bottom = create_torus(self,context,"Column_cir_bottom",radio_bottom,self.cir_base_r,self.cir_base_z) 84 | bpy.ops.object.select_all(False) 85 | cir_bottom.select = True 86 | bpy.context.scene.objects.active = cir_bottom 87 | set_modifier_subsurf(cir_bottom) 88 | set_smooth(cir_bottom) 89 | cir_bottom.location.x = 0.0 90 | cir_bottom.location.y = 0.0 91 | cir_bottom.location.z = self.cir_base_z / 2 92 | cir_bottom.parent = myColumn 93 | 94 | #------------------------ 95 | # Rectangular base 96 | #------------------------ 97 | if (self.box_base == True): 98 | box_bottom = create_rectangular_base(self,context,"Column_box_bottom", self.box_base_x, self.box_base_y, self.box_base_z) 99 | bpy.ops.object.select_all(False) 100 | box_bottom.select = True 101 | bpy.context.scene.objects.active = box_bottom 102 | box_bottom.parent = myColumn 103 | box_bottom.location.x = 0.0 104 | box_bottom.location.y = 0.0 105 | box_bottom.location.z = - self.box_base_z 106 | # move column 107 | myColumn.location.z += self.box_base_z 108 | 109 | #------------------------ 110 | # Circular top 111 | #------------------------ 112 | if (self.cir_top == True): 113 | cir_top = create_torus(self,context,"Column_cir_top",radio_top,self.cir_top_r,self.cir_top_z) 114 | bpy.ops.object.select_all(False) 115 | cir_top.select = True 116 | bpy.context.scene.objects.active = cir_top 117 | set_modifier_subsurf(cir_top) 118 | set_smooth(cir_top) 119 | cir_top.parent = myColumn 120 | cir_top.location.x = 0.0 121 | cir_top.location.y = 0.0 122 | cir_top.location.z = height - self.cir_top_z / 2 123 | 124 | #------------------------ 125 | # Rectangular top 126 | #------------------------ 127 | if (self.box_top == True): 128 | box_top = create_rectangular_base(self,context,"Column_box_bottom", self.box_top_x, self.box_top_y, self.box_top_z) 129 | bpy.ops.object.select_all(False) 130 | box_top.select = True 131 | bpy.context.scene.objects.active = box_top 132 | box_top.parent = myColumn 133 | box_top.location.x = 0.0 134 | box_top.location.y = 0.0 135 | box_top.location.z = height 136 | 137 | #------------------------ 138 | # Create arc 139 | #------------------------ 140 | if (self.arc_top): 141 | myArc = create_arc(self,context,"Column_arch",self.arc_radio,self.arc_gap,self.arc_width,self.array_space_factor) 142 | myArc.parent = myColumn 143 | bpy.ops.object.select_all(False) 144 | myArc.select = True 145 | bpy.context.scene.objects.active = myArc 146 | set_normals(myArc) 147 | set_modifier_mirror(myArc,"X") 148 | myArc.location.x = self.arc_radio + self.arc_gap 149 | myArc.location.y = 0.0 150 | if (self.box_top == True): 151 | myArc.location.z = height + self.box_top_z 152 | else: 153 | myArc.location.z = height 154 | #------------------------ 155 | # Create Array X 156 | #------------------------ 157 | if (self.array_num_x > 0): 158 | if (self.arc_top): 159 | distance = ((self.arc_radio + self.arc_gap) * 2) 160 | else: 161 | distance = self.array_space_x 162 | 163 | if (self.crt_array): 164 | set_modifier_array(myColumn,"X",0,self.array_num_x, True, distance) 165 | 166 | if (self.box_base == True): 167 | set_modifier_array(box_bottom,"X",0,self.array_num_x,True,distance) 168 | if (self.box_top == True): 169 | set_modifier_array(box_top,"X",0,self.array_num_x,True,distance) 170 | 171 | if (self.cir_base == True): 172 | set_modifier_array(cir_bottom,"X",0,self.array_num_x, True, distance) 173 | if (self.cir_top == True): 174 | set_modifier_array(cir_top,"X",0,self.array_num_x, True, distance) 175 | 176 | if (self.arc_top): 177 | if (self.array_num_x > 1): 178 | set_modifier_array(myArc,"X",1,self.array_num_x - 1) # one arc minus 179 | #------------------------ 180 | # Create Array Y 181 | #------------------------ 182 | if (self.array_num_y > 0): 183 | if (self.arc_top): 184 | distance = self.arc_width 185 | else: 186 | distance = self.array_space_y 187 | 188 | if (self.crt_array): 189 | set_modifier_array(myColumn,"Y",0,self.array_num_y, True, distance) 190 | 191 | if (self.box_base == True): 192 | set_modifier_array(box_bottom,"Y",0,self.array_num_y,True,distance) 193 | if (self.box_top == True): 194 | set_modifier_array(box_top,"Y",0,self.array_num_y,True,distance) 195 | 196 | if (self.cir_base == True): 197 | set_modifier_array(cir_bottom,"Y",0,self.array_num_y, True, distance) 198 | if (self.cir_top == True): 199 | set_modifier_array(cir_top,"Y",0,self.array_num_y, True, distance) 200 | 201 | if (self.arc_top): 202 | if (self.array_num_y > 1): 203 | set_modifier_array(myArc,"Y",1,self.array_num_y - 1) # one less 204 | 205 | #------------------------ 206 | # Create materials 207 | #------------------------ 208 | if (self.crt_mat): 209 | # Column material 210 | mat = create_diffuse_material("Column_material",False,0.748, 0.734, 0.392,0.573,0.581,0.318) 211 | set_material(myColumn,mat) 212 | 213 | if (self.box_base == True or self.box_top == True): 214 | mat = create_diffuse_material("Column_rect",False,0.56,0.56,0.56,0.56,0.56,0.56) 215 | if (self.box_base == True): set_material(box_bottom,mat) 216 | if (self.box_top == True): set_material(box_top,mat) 217 | 218 | if (self.cir_base == True or self.cir_top == True): 219 | mat = create_diffuse_material("Column_cir",False,0.65,0.65,0.65,0.65,0.65,0.65) 220 | if (self.cir_base == True): set_material(cir_bottom,mat) 221 | if (self.cir_top == True): set_material(cir_top,mat) 222 | 223 | if (self.arc_top): 224 | mat = create_diffuse_material("Column_arch",False,0.8,0.8,0.8) 225 | set_material(myArc,mat) 226 | 227 | 228 | bpy.ops.object.select_all(False) 229 | myColumn.select = True 230 | bpy.context.scene.objects.active = myColumn 231 | 232 | return 233 | #------------------------------------------------------------------------------ 234 | # Create Column 235 | #------------------------------------------------------------------------------ 236 | def create_circular_column(self,context,objName,radio_top,radio_mid,radio_bottom,height): 237 | 238 | myVertex = [] 239 | myFaces = [] 240 | pies = [0,30,60,90,120,150,180,210,240,270,300,330] # circle 241 | 242 | # Add bottom circle 243 | for pie in pies: 244 | x = math.cos(math.radians(pie)) * radio_bottom 245 | y = math.sin(math.radians(pie)) * radio_bottom 246 | myPoint = [(x,y,0.0)] 247 | myVertex.extend(myPoint) 248 | # Add middle circle 249 | for pie in pies: 250 | x = math.cos(math.radians(pie)) * radio_mid 251 | y = math.sin(math.radians(pie)) * radio_mid 252 | myPoint = [(x,y,height / 2)] 253 | myVertex.extend(myPoint) 254 | # Add top circle 255 | for pie in pies: 256 | x = math.cos(math.radians(pie)) * radio_top 257 | y = math.sin(math.radians(pie)) * radio_top 258 | myPoint = [(x,y,height)] 259 | myVertex.extend(myPoint) 260 | #------------------------------------- 261 | # Faces 262 | #------------------------------------- 263 | t = 1 264 | for n in range(0,len(pies) * 2): 265 | t = t + 1 266 | if (t > len(pies)): 267 | t = 1 268 | myFace = [(n,n - len(pies) + 1,n + 1,n + len(pies))] 269 | myFaces.extend(myFace) 270 | else: 271 | myFace = [(n,n+1,n + len(pies) + 1,n + len(pies))] 272 | myFaces.extend(myFace) 273 | 274 | 275 | mesh = bpy.data.meshes.new(objName) 276 | myobject = bpy.data.objects.new(objName, mesh) 277 | 278 | myobject.location = bpy.context.scene.cursor_location 279 | bpy.context.scene.objects.link(myobject) 280 | 281 | mesh.from_pydata(myVertex, [], myFaces) 282 | mesh.update(calc_edges=True) 283 | 284 | return myobject 285 | #------------------------------------------------------------------------------ 286 | # Create Torus 287 | #------------------------------------------------------------------------------ 288 | def create_torus(self,context,objName,radio_inside, radio_outside, height): 289 | 290 | myVertex = [] 291 | myFaces = [] 292 | pies = [0,30,60,90,120,150,180,210,240,270,300,330] # circle 293 | segments = [80,60,30,0,330,300,280] # section 294 | 295 | radio_mid = radio_outside + radio_inside - (height / 2) 296 | # Add internal circles Top 297 | for pie in pies: 298 | x = math.cos(math.radians(pie)) * radio_inside 299 | y = math.sin(math.radians(pie)) * radio_inside 300 | myPoint = [(x,y,height / 2)] 301 | myVertex.extend(myPoint) 302 | # Add external circles Top 303 | for pie in pies: 304 | x = math.cos(math.radians(pie)) * radio_mid 305 | y = math.sin(math.radians(pie)) * radio_mid 306 | myPoint = [(x,y,height / 2)] 307 | myVertex.extend(myPoint) 308 | # Add Intermediate lines 309 | for segment in segments: 310 | for pie in pies: 311 | radio_externo = radio_mid + (height * math.cos(math.radians(segment))) 312 | x = math.cos(math.radians(pie)) * radio_externo 313 | y = math.sin(math.radians(pie)) * radio_externo 314 | z = math.sin(math.radians(segment)) * (height / 2) 315 | 316 | myPoint = [(x,y,z)] 317 | myVertex.extend(myPoint) 318 | 319 | # Add internal circles Bottom 320 | for pie in pies: 321 | x = math.cos(math.radians(pie)) * radio_inside 322 | y = math.sin(math.radians(pie)) * radio_inside 323 | myPoint = [(x,y,height / 2 * -1)] 324 | myVertex.extend(myPoint) 325 | # Add external circles bottom 326 | for pie in pies: 327 | x = math.cos(math.radians(pie)) * radio_mid 328 | y = math.sin(math.radians(pie)) * radio_mid 329 | myPoint = [(x,y,height / 2 * -1)] 330 | myVertex.extend(myPoint) 331 | 332 | #------------------------------------- 333 | # Faces 334 | #------------------------------------- 335 | t = 1 336 | for n in range(0,len(pies) * len(segments) + (len(pies) * 2)): 337 | t = t + 1 338 | if (t > len(pies)): 339 | t = 1 340 | myFace = [(n,n - len(pies) + 1,n + 1,n + len(pies))] 341 | myFaces.extend(myFace) 342 | else: 343 | myFace = [(n,n+1,n + len(pies) + 1,n + len(pies))] 344 | myFaces.extend(myFace) 345 | 346 | 347 | mesh = bpy.data.meshes.new(objName) 348 | myobject = bpy.data.objects.new(objName, mesh) 349 | 350 | myobject.location = bpy.context.scene.cursor_location 351 | bpy.context.scene.objects.link(myobject) 352 | 353 | mesh.from_pydata(myVertex, [], myFaces) 354 | mesh.update(calc_edges=True) 355 | 356 | return myobject 357 | 358 | #------------------------------------------------------------------------------ 359 | # Create rectangular base 360 | #------------------------------------------------------------------------------ 361 | def create_rectangular_base(self,context,objName,x,y,z): 362 | 363 | myVertex = [(-x/2, -y/2, 0.0), (- x/2, y/2, 0.0), (x/2, y/2, 0.0), (x/2, -y/2, 0.0) 364 | ,(-x/2, -y/2, z), (- x/2, y/2, z), (x/2, y/2, z), (x/2, -y/2, z)] 365 | myFaces = [(0,1,2,3),(0,1,5,4),(1,2,6,5),(2,6,7,3),(5,6,7,4),(0,4,7,3)] 366 | 367 | mesh = bpy.data.meshes.new(objName) 368 | myobject = bpy.data.objects.new(objName, mesh) 369 | 370 | myobject.location = bpy.context.scene.cursor_location 371 | bpy.context.scene.objects.link(myobject) 372 | 373 | mesh.from_pydata(myVertex, [], myFaces) 374 | mesh.update(calc_edges=True) 375 | 376 | return myobject 377 | 378 | #------------------------------------------------------------------------------ 379 | # Create arc 380 | #------------------------------------------------------------------------------ 381 | def create_arc(self,context,objName,radio,gap,thickness,center): 382 | 383 | myVertex = [] 384 | 385 | half = (thickness / 2) 386 | move = half * center 387 | 388 | list = [half + move,-half + move] 389 | for pos_y in list: 390 | #-------------------------------- 391 | # First vertices 392 | #-------------------------------- 393 | myVertex.extend([(-radio - gap,pos_y,radio + radio / 10)]) 394 | # Flat cuts 395 | angle = 13 * (180 / 16) 396 | for i in range(1,4): 397 | z = math.sin(math.radians(angle)) * radio 398 | myPoint = [(-radio - gap,pos_y,z)] 399 | myVertex.extend(myPoint) 400 | angle = angle + 180 / 16 401 | 402 | myVertex.extend([(-radio - gap,pos_y,0.0)]) 403 | #-------------------------------- 404 | # Arc points 405 | #-------------------------------- 406 | angle = 180 407 | for i in range(0,9): 408 | x = math.cos(math.radians(angle)) * radio 409 | z = math.sin(math.radians(angle)) * radio 410 | myPoint = [(x,pos_y,z)] 411 | myVertex.extend(myPoint) 412 | 413 | angle = angle - 180 / 16 414 | # #-------------------------------- 415 | # vertical cut points 416 | #-------------------------------- 417 | angle = 8 * (180 / 16) 418 | for i in range(1,5): 419 | x = math.cos(math.radians(angle)) * radio 420 | myPoint = [(x,pos_y,radio + radio / 10)] 421 | myVertex.extend(myPoint) 422 | 423 | angle = angle + 180 / 16 424 | 425 | 426 | myFaces = [(23, 24, 21, 22),(24, 25, 20, 21),(25, 26, 19, 20),(27, 18, 19, 26),(18, 27, 28, 35) 427 | ,(28, 29, 34, 35),(29, 30, 33, 34),(30, 31, 32, 33),(12, 13, 31, 30),(29, 11, 12, 30) 428 | ,(11, 29, 28, 10),(10, 28, 27, 9),(9, 27, 26, 8),(25, 7, 8, 26),(24, 6, 7, 25) 429 | ,(23, 5, 6, 24),(22, 4, 5, 23),(5, 4, 3, 6),(6, 3, 2, 7),(7, 2, 1, 8) 430 | ,(8, 1, 0, 9),(9, 0, 17, 10),(10, 17, 16, 11),(11, 16, 15, 12),(14, 13, 12, 15) 431 | ,(21, 3, 4, 22),(20, 2, 3, 21),(19, 1, 2, 20),(1, 19, 18, 0),(0, 18, 35, 17) 432 | ,(17, 35, 34, 16),(33, 15, 16, 34),(32, 14, 15, 33)] 433 | 434 | mesh = bpy.data.meshes.new(objName) 435 | myObject = bpy.data.objects.new(objName, mesh) 436 | 437 | myObject.location = bpy.context.scene.cursor_location 438 | bpy.context.scene.objects.link(myObject) 439 | 440 | mesh.from_pydata(myVertex, [], myFaces) 441 | mesh.update(calc_edges=True) 442 | 443 | return myObject 444 | #---------------------------------------------- 445 | # Code to run alone the script 446 | #---------------------------------------------- 447 | if __name__ == "__main__": 448 | create_mesh(0) 449 | print("Executed") 450 | -------------------------------------------------------------------------------- /archimesh/src/roof_maker.py: -------------------------------------------------------------------------------- 1 | # ***** BEGIN GPL LICENSE BLOCK ***** 2 | # 3 | # 4 | # This program is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU General Public License 6 | # as published by the Free Software Foundation; either version 2 7 | # of the License, or (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software Foundation, 16 | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | # 18 | # ***** END GPL LICENCE BLOCK ***** 19 | 20 | #---------------------------------------------------------- 21 | # File: roof_maker.py 22 | # Automatic generation of roofs 23 | # Author: Antonio Vazquez (antonioya) 24 | # 25 | #---------------------------------------------------------- 26 | import bpy 27 | import mathutils 28 | import math 29 | from tools import * 30 | 31 | #------------------------------------------------------------------------------ 32 | # Generate mesh data 33 | # All custom values are passed using self container (self.myvariable) 34 | #------------------------------------------------------------------------------ 35 | def create_mesh(self,context): 36 | 37 | # deactivate others 38 | for o in bpy.data.objects: 39 | if (o.select == True): 40 | o.select = False 41 | bpy.ops.object.select_all(False) 42 | 43 | myData = create_roof(self,context) 44 | myRoof = myData[0] 45 | tile_x = myData[1] 46 | tile_y = myData[2] 47 | 48 | # active object and deactivate others 49 | if (bpy.context.scene.objects.active != None): 50 | bpy.context.scene.objects.active.select = False 51 | 52 | bpy.context.scene.objects.active = myRoof 53 | myRoof.select = True 54 | 55 | # Thicknes 56 | if (self.roof_thick > 0.0): 57 | set_modifier_solidify(myRoof,self.roof_thick) 58 | # Subsurf 59 | set_modifier_subsurf(myRoof) 60 | set_smooth(myRoof) 61 | 62 | if (self.model == "1"): 63 | a_x = 0.85 64 | a_y = 0.85 65 | b_x = 0.886 66 | b_y = 0.8581 67 | 68 | if (self.model == "2"): 69 | a_x = 0.90 70 | a_y = 0.85 71 | b_x = 1.04198 72 | b_y = 0.863065 73 | 74 | if (self.model == "3"): 75 | a_x = 0.80 76 | a_y = 0.85 77 | b_x = 0.905358 78 | b_y = 0.88575 79 | 80 | if (self.model == "4"): 81 | a_x = 0.80 82 | a_y = 0.85 83 | b_x = 0.82630 84 | b_y = 0.86162 85 | 86 | set_modifier_array(myRoof,"X",a_x, self.roof_width) 87 | set_modifier_array(myRoof,"Y",a_y, self.roof_height) 88 | 89 | tile_x = tile_x * self.roof_scale * b_x 90 | tile_y = tile_y * self.roof_scale * b_y 91 | 92 | p_x = tile_x * self.roof_width 93 | p_y = tile_y * self.roof_height 94 | 95 | # Slope 96 | myRoof.rotation_euler = (math.radians(self.roof_angle), 0.0, 0.0) 97 | 98 | # Create materials 99 | if (self.crt_mat): 100 | # material 101 | mat = create_diffuse_material("Roof_material",False,0.482, 0.061, 0.003,0.581,0.105,0.068,0.01) 102 | set_material(myRoof,mat) 103 | 104 | bpy.ops.object.select_all(False) 105 | myRoof.select = True 106 | bpy.context.scene.objects.active = myRoof 107 | return 108 | #------------------------------------------------------------------------------ 109 | # Create Roof 110 | # All custom values are passed using self container (self.myvariable) 111 | #------------------------------------------------------------------------------ 112 | def create_roof(self,context): 113 | # Retry mesh data 114 | if (self.model == "1"): 115 | myData = tile_model_01(self,context) 116 | elif (self.model == "2"): 117 | myData = tile_model_02(self,context) 118 | elif (self.model == "3"): 119 | myData = tile_model_03(self,context) 120 | elif (self.model == "4"): 121 | myData = tile_model_04(self,context) 122 | else: 123 | myData = tile_model_01(self,context) # default model 124 | 125 | # move data 126 | verts = myData[0] 127 | faces = myData[1] 128 | tile_x = myData[2] 129 | tile_y = myData[3] 130 | 131 | mymesh = bpy.data.meshes.new("Roof") 132 | myobject = bpy.data.objects.new("Roof", mymesh) 133 | 134 | myobject.location = bpy.context.scene.cursor_location 135 | bpy.context.scene.objects.link(myobject) 136 | 137 | mymesh.from_pydata(verts, [], faces) 138 | mymesh.update(calc_edges=True) 139 | # Scale 140 | myobject.scale = (self.roof_scale,self.roof_scale,self.roof_scale) 141 | 142 | return (myobject,tile_x,tile_y) 143 | #---------------------------------------------- 144 | # Tile model 01 145 | #---------------------------------------------- 146 | def tile_model_01(self,context): 147 | #------------------------------------ 148 | # Mesh data 149 | #------------------------------------ 150 | minX = -2.60770320892334e-08 151 | maxX = 0.19982914626598358 152 | minY = -0.0010638721287250519 153 | maxY = 0.46471506357192993 154 | minZ = -0.03651249408721924 155 | maxZ = 0.0586184486746788 156 | 157 | # Vertex 158 | myVertex = [(maxX - 0.0912834107875824,maxY - 0.0017275810241699219,maxZ - 0.046515291556715965) 159 | ,(maxX - 0.08774729073047638,maxY - 0.0021544992923736572,minZ + 0.02855057455599308) 160 | ,(minX + 0.007649015635251999,maxY - 0.002105712890625,minZ + 0.03084239922463894) 161 | ,(minX + 0.012062381953001022,maxY - 0.0016825199127197266,maxZ - 0.044397931545972824) 162 | ,(minX + 0.023753326386213303,maxY - 0.0013274550437927246,maxZ - 0.02770993858575821) 163 | ,(minX + 0.04094201326370239,maxY - 0.0010945796966552734,maxZ - 0.016765158623456955) 164 | ,(minX + 0.061011623591184616,maxY - 0.0010193586349487305,maxZ - 0.013229843229055405) 165 | ,(minX + 0.09759850427508354,maxY - 0.0013619065284729004,maxZ - 0.02933049201965332) 166 | ,(minX + 0.0809067152440548,maxY - 0.0011132359504699707,maxZ - 0.017642192542552948) 167 | ,(minX + 0.04091371223330498,maxY - 0.005662411451339722,maxZ - 0.01663973182439804) 168 | ,(minX + 0.061012353748083115,maxY - 0.00558704137802124,maxZ - 0.013099301606416702) 169 | ,(minX + 0.007572557777166367,maxY - 0.006675034761428833,minZ + 0.030899077653884888) 170 | ,(minX + 0.011992301791906357,maxY - 0.006251156330108643,maxZ - 0.044312480837106705) 171 | ,(minX + 0.09765215590596199,maxY - 0.005930125713348389,maxZ - 0.029223240911960602) 172 | ,(maxX - 0.09121392667293549,maxY - 0.006296277046203613,maxZ - 0.04643290489912033) 173 | ,(minX + 0.02370016649365425,maxY - 0.00589558482170105,maxZ - 0.027600344270467758) 174 | ,(maxX - 0.08767268061637878,maxY - 0.006723880767822266,minZ + 0.028603939339518547) 175 | ,(minX + 0.08093622699379921,maxY - 0.005681097507476807,maxZ - 0.01751803606748581) 176 | ,(minX + 0.06108579412102699,minY + 0.0018242448568344116,maxZ) 177 | ,(minX + 0.0049602799117565155,minY + 0.0010638684034347534,maxZ - 0.03573753498494625) 178 | ,(maxX - 0.08424043655395508,minY + 0.0010122060775756836,maxZ - 0.038165315985679626) 179 | ,(minX + 0.018365193158388138,minY + 0.0014709830284118652,maxZ - 0.016602978110313416) 180 | ,(maxX - 0.0801858901977539,minY + 0.0005226880311965942,minZ + 0.03395887836813927) 181 | ,(minX + 0.08389763161540031,minY + 0.0017166286706924438,maxZ - 0.005059238523244858) 182 | ,(minX + 0.03807384893298149,minY + 0.001738026738166809,maxZ - 0.004053622484207153) 183 | ,(minX + 1.1175870895385742e-08,minY + 0.0010638725943863392,minZ + 0.03651248663663864) 184 | ,(maxX - 0.09679263085126877,minY + 0.0014314353466033936,maxZ - 0.018461115658283234) 185 | ,(minX + 0.06108483672142029,minY + 0.007804900407791138,maxZ - 0.00017091631889343262) 186 | ,(minX + 0.0050520338118076324,minY + 0.0070457905530929565,maxZ - 0.03584941849112511) 187 | ,(maxX - 0.08433142304420471,minY + 0.006994202733039856,maxZ - 0.03827318921685219) 188 | ,(minX + 0.018434803932905197,minY + 0.007452219724655151,maxZ - 0.01674646884202957) 189 | ,(maxX - 0.08028358221054077,minY + 0.006505459547042847,minZ + 0.03388900891877711) 190 | ,(minX + 0.08385899290442467,minY + 0.007697448134422302,maxZ - 0.005221795290708542) 191 | ,(minX + 0.03811090067028999,minY + 0.007718801498413086,maxZ - 0.004217840731143951) 192 | ,(minX,minY + 0.006561309099197388,minZ + 0.036512489430606365) 193 | ,(maxX - 0.09686288237571716,minY + 0.007412716746330261,maxZ - 0.018601536750793457) 194 | ,(maxX - 0.011097520589828491,maxY - 0.00127333402633667,minZ + 0.03322591632604599) 195 | ,(maxX - 0.007561400532722473,maxY,maxZ - 0.041875842958688736) 196 | ,(minX + 0.0878349058330059,maxY - 0.00014543533325195312,maxZ - 0.04416356980800629) 197 | ,(minX + 0.09224827215075493,maxY - 0.0014076828956604004,minZ + 0.03111234214156866) 198 | ,(maxX - 0.09588995575904846,maxY - 0.0024666786193847656,minZ + 0.014454199001193047) 199 | ,(maxX - 0.07870127260684967,maxY - 0.003161191940307617,minZ + 0.003528997302055359) 200 | ,(maxX - 0.05863165855407715,maxY - 0.0033855140209198,minZ) 201 | ,(maxX - 0.022044777870178223,maxY - 0.0023638010025024414,minZ + 0.016071850433945656) 202 | ,(maxX - 0.03873656690120697,maxY - 0.0031055212020874023,minZ + 0.0044044628739356995) 203 | ,(maxX - 0.07872956991195679,maxY - 0.007723212242126465,minZ + 0.003790721297264099) 204 | ,(maxX - 0.05863092839717865,maxY - 0.007947862148284912,minZ + 0.0002566203474998474) 205 | ,(minX + 0.08775844797492027,maxY - 0.004703164100646973,maxZ - 0.043833211064338684) 206 | ,(minX + 0.09217819198966026,maxY - 0.005967140197753906,minZ + 0.03141397051513195) 207 | ,(maxX - 0.021991118788719177,maxY - 0.006924688816070557,minZ + 0.016351722180843353) 208 | ,(maxX - 0.01102803647518158,maxY - 0.005832552909851074,minZ + 0.03353060130029917) 209 | ,(maxX - 0.09594311565160751,maxY - 0.007027685642242432,minZ + 0.01473172940313816) 210 | ,(maxX - 0.007486790418624878,maxY - 0.004557549953460693,maxZ - 0.04154217056930065) 211 | ,(maxX - 0.03870706260204315,maxY - 0.007667511701583862,minZ + 0.004667460918426514) 212 | ,(maxX - 0.05855749547481537,minY,minZ + 0.026008986867964268) 213 | ,(minX + 0.08514617010951042,minY + 0.0022678226232528687,maxZ - 0.033448345959186554) 214 | ,(maxX - 0.004054546356201172,minY + 0.0024218857288360596,maxZ - 0.031024910509586334) 215 | ,(minX + 0.09855108335614204,minY + 0.0010535866022109985,minZ + 0.04258226789534092) 216 | ,(maxX,minY + 0.0038818269968032837,maxZ - 0.008059307932853699) 217 | ,(maxX - 0.03574565052986145,minY + 0.00032107532024383545,minZ + 0.03105917200446129) 218 | ,(maxX - 0.08156943321228027,minY + 0.0002572685480117798,minZ + 0.030055356211960316) 219 | ,(minX + 0.0801859013736248,minY + 0.004204884171485901,maxZ - 0.01064956933259964) 220 | ,(maxX - 0.016606733202934265,minY + 0.0011714845895767212,minZ + 0.04443708248436451) 221 | ,(maxX - 0.058558449149131775,minY + 0.005973652005195618,minZ + 0.0256729768589139) 222 | ,(minX + 0.08523792400956154,minY + 0.008237749338150024,maxZ - 0.03384328447282314) 223 | ,(maxX - 0.004145532846450806,minY + 0.008391529321670532,maxZ - 0.031423844397068024) 224 | ,(minX + 0.0986206941306591,minY + 0.00702551007270813,minZ + 0.04221887979656458) 225 | ,(maxX - 9.769201278686523e-05,minY + 0.00984904170036316,maxZ - 0.008496180176734924) 226 | ,(maxX - 0.0357842892408371,minY + 0.0062942057847976685,minZ + 0.030714819207787514) 227 | ,(maxX - 0.08153238147497177,minY + 0.006230458617210388,minZ + 0.029712661169469357) 228 | ,(minX + 0.08018588647246361,minY + 0.00968259572982788,maxZ - 0.011114969849586487) 229 | ,(maxX - 0.016676992177963257,minY + 0.007143184542655945,minZ + 0.04407063312828541)] 230 | 231 | # Faces 232 | myFaces = [(10, 9, 5, 6),(12, 11, 2, 3),(14, 13, 7, 0),(15, 12, 3, 4),(16, 14, 0, 1) 233 | ,(17, 10, 6, 8),(9, 15, 4, 5),(13, 17, 8, 7),(27, 33, 9, 10),(28, 34, 11, 12) 234 | ,(29, 35, 13, 14),(30, 28, 12, 15),(31, 29, 14, 16),(32, 27, 10, 17),(33, 30, 15, 9) 235 | ,(35, 32, 17, 13),(18, 24, 33, 27),(19, 25, 34, 28),(20, 26, 35, 29),(21, 19, 28, 30) 236 | ,(22, 20, 29, 31),(23, 18, 27, 32),(24, 21, 30, 33),(26, 23, 32, 35),(46, 45, 41, 42) 237 | ,(48, 47, 38, 39),(50, 49, 43, 36),(51, 48, 39, 40),(52, 50, 36, 37),(53, 46, 42, 44) 238 | ,(45, 51, 40, 41),(49, 53, 44, 43),(63, 69, 45, 46),(64, 70, 47, 48),(65, 71, 49, 50) 239 | ,(66, 64, 48, 51),(67, 65, 50, 52),(68, 63, 46, 53),(69, 66, 51, 45),(71, 68, 53, 49) 240 | ,(54, 60, 69, 63),(55, 61, 70, 64),(56, 62, 71, 65),(57, 55, 64, 66),(58, 56, 65, 67) 241 | ,(59, 54, 63, 68),(60, 57, 66, 69),(62, 59, 68, 71)] 242 | 243 | return (myVertex,myFaces,maxX - minX, maxY - minY) 244 | 245 | #---------------------------------------------- 246 | # Tile model 02 247 | #---------------------------------------------- 248 | def tile_model_02(self,context): 249 | #------------------------------------ 250 | # Mesh data 251 | #------------------------------------ 252 | minX = -2.60770320892334e-08 253 | maxX = 0.11964325606822968 254 | minY = -0.000541184563189745 255 | maxY = 0.4636957049369812 256 | minZ = -0.007961912080645561 257 | maxZ = 0.0586184561252594 258 | 259 | # Vertex 260 | myVertex = [(maxX - 0.011097520589828491,maxY - 0.0007082223892211914,minZ + 0.020065076649188995) 261 | ,(maxX - 0.007561400532722473,maxY - 0.0011351406574249268,minZ) 262 | ,(minX + 0.007649015635251999,maxY - 0.0010863542556762695,minZ + 0.0022918246686458588) 263 | ,(minX + 0.012062381953001022,maxY - 0.0006631612777709961,minZ + 0.022182436659932137) 264 | ,(minX + 0.023753326386213303,maxY - 0.00030809640884399414,maxZ - 0.02770993858575821) 265 | ,(minX + 0.04094201326370239,maxY - 7.522106170654297e-05,maxZ - 0.016765158623456955) 266 | ,(maxX - 0.05863165855407715,maxY,maxZ - 0.013229843229055405) 267 | ,(maxX - 0.022044777870178223,maxY - 0.0003425478935241699,maxZ - 0.02933049201965332) 268 | ,(maxX - 0.03873656690120697,maxY - 9.387731552124023e-05,maxZ - 0.017642192542552948) 269 | ,(minX + 0.04091371223330498,maxY - 0.004643052816390991,maxZ - 0.01663973182439804) 270 | ,(maxX - 0.05863092839717865,maxY - 0.00456768274307251,maxZ - 0.013099301606416702) 271 | ,(minX + 0.007572557777166367,maxY - 0.0056556761264801025,minZ + 0.0023485030978918076) 272 | ,(minX + 0.011992301791906357,maxY - 0.005231797695159912,minZ + 0.022267887368798256) 273 | ,(maxX - 0.021991126239299774,maxY - 0.004910767078399658,maxZ - 0.029223240911960602) 274 | ,(maxX - 0.01102803647518158,maxY - 0.005276918411254883,minZ + 0.02014746330678463) 275 | ,(minX + 0.02370016649365425,maxY - 0.004876226186752319,maxZ - 0.027600344270467758) 276 | ,(maxX - 0.007486790418624878,maxY - 0.005704522132873535,minZ + 5.336478352546692e-05) 277 | ,(maxX - 0.038707055151462555,maxY - 0.004661738872528076,maxZ - 0.01751803606748581) 278 | ,(maxX - 0.05855748802423477,minY + 0.0013015568256378174,maxZ) 279 | ,(minX + 0.0049602799117565155,minY + 0.0005411803722381592,minZ + 0.03084283322095871) 280 | ,(maxX - 0.004054546356201172,minY + 0.0004895180463790894,minZ + 0.028415052220225334) 281 | ,(minX + 0.018365193158388138,minY + 0.000948294997215271,maxZ - 0.016602978110313416) 282 | ,(maxX,minY,minZ + 0.005408303812146187) 283 | ,(maxX - 0.03574565052986145,minY + 0.0011939406394958496,maxZ - 0.005059238523244858) 284 | ,(minX + 0.03807384893298149,minY + 0.0012153387069702148,maxZ - 0.004053622484207153) 285 | ,(minX + 1.1175870895385742e-08,minY + 0.000541184563189745,minZ + 0.007961912080645561) 286 | ,(maxX - 0.016606740653514862,minY + 0.0009087473154067993,maxZ - 0.018461115658283234) 287 | ,(maxX - 0.058558445423841476,minY + 0.0072822123765945435,maxZ - 0.00017091631889343262) 288 | ,(minX + 0.0050520338118076324,minY + 0.006523102521896362,minZ + 0.030730949714779854) 289 | ,(maxX - 0.004145532846450806,minY + 0.006471514701843262,minZ + 0.028307178989052773) 290 | ,(minX + 0.018434803932905197,minY + 0.006929531693458557,maxZ - 0.01674646884202957) 291 | ,(maxX - 9.769201278686523e-05,minY + 0.0059827715158462524,minZ + 0.005338434362784028) 292 | ,(maxX - 0.0357842892408371,minY + 0.007174760103225708,maxZ - 0.005221795290708542) 293 | ,(minX + 0.03811090067028999,minY + 0.007196113467216492,maxZ - 0.004217840731143951) 294 | ,(minX,minY + 0.0060386210680007935,minZ + 0.007961914874613285) 295 | ,(maxX - 0.016676992177963257,minY + 0.006890028715133667,maxZ - 0.018601536750793457)] 296 | 297 | # Faces 298 | myFaces = [(10, 9, 5, 6),(12, 11, 2, 3),(14, 13, 7, 0),(15, 12, 3, 4),(16, 14, 0, 1) 299 | ,(17, 10, 6, 8),(9, 15, 4, 5),(13, 17, 8, 7),(27, 33, 9, 10),(28, 34, 11, 12) 300 | ,(29, 35, 13, 14),(30, 28, 12, 15),(31, 29, 14, 16),(32, 27, 10, 17),(33, 30, 15, 9) 301 | ,(35, 32, 17, 13),(18, 24, 33, 27),(19, 25, 34, 28),(20, 26, 35, 29),(21, 19, 28, 30) 302 | ,(22, 20, 29, 31),(23, 18, 27, 32),(24, 21, 30, 33),(26, 23, 32, 35)] 303 | 304 | return (myVertex,myFaces,maxX - minX, maxY - minY) 305 | 306 | #---------------------------------------------- 307 | # Tile model 03 308 | #---------------------------------------------- 309 | def tile_model_03(self,context): 310 | #------------------------------------ 311 | # Mesh data 312 | #------------------------------------ 313 | minX = -1.1175870895385742e-08 314 | maxX = 0.19973646104335785 315 | minY = -0.007466380018740892 316 | maxY = 0.4636957049369812 317 | minZ = -0.014226417988538742 318 | maxZ = 0.0586184561252594 319 | 320 | # Vertex 321 | myVertex = [(maxX - 0.09119071066379547,maxY - 0.0007082223892211914,minZ + 0.026329582557082176) 322 | ,(maxX - 0.08765459060668945,maxY - 0.0011351406574249268,minZ + 0.006264505907893181) 323 | ,(minX + 0.007649015635251999,maxY - 0.0010863542556762695,minZ + 0.00855633057653904) 324 | ,(minX + 0.012062381953001022,maxY - 0.0006631612777709961,minZ + 0.028446942567825317) 325 | ,(minX + 0.023753326386213303,maxY - 0.00030809640884399414,maxZ - 0.02770993858575821) 326 | ,(minX + 0.04094201326370239,maxY - 7.522106170654297e-05,maxZ - 0.016765158623456955) 327 | ,(minX + 0.061011623591184616,maxY,maxZ - 0.013229843229055405) 328 | ,(minX + 0.09759850427508354,maxY - 0.0003425478935241699,maxZ - 0.02933049201965332) 329 | ,(minX + 0.0809067152440548,maxY - 9.387731552124023e-05,maxZ - 0.017642192542552948) 330 | ,(maxX,minY,minZ + 0.009998040273785591) 331 | ,(maxX,maxY - 0.0012684464454650879,minZ) 332 | ,(maxX - 0.011666849255561829,minY + 5.453824996948242e-06,minZ + 0.01025407388806343) 333 | ,(maxX - 0.012786239385604858,maxY - 0.0012489855289459229,minZ + 0.0009138062596321106) 334 | ,(maxX - 0.00027532875537872314,minY + 0.00016899406909942627,minZ + 0.017940200865268707) 335 | ,(maxX - 0.00027532875537872314,maxY - 0.0010994374752044678,minZ + 0.007942160591483116) 336 | ,(maxX - 0.011416733264923096,minY + 0.00017443299293518066,minZ + 0.018196236342191696) 337 | ,(maxX - 0.012485697865486145,maxY - 0.0010799765586853027,minZ + 0.008855968713760376) 338 | ,(minX + 0.04091371223330498,maxY - 0.004643052816390991,maxZ - 0.01663973182439804) 339 | ,(minX + 0.061012353748083115,maxY - 0.00456768274307251,maxZ - 0.013099301606416702) 340 | ,(minX + 0.007572557777166367,maxY - 0.0056556761264801025,minZ + 0.008613009005784988) 341 | ,(minX + 0.011992301791906357,maxY - 0.005231797695159912,minZ + 0.028532393276691437) 342 | ,(minX + 0.09765215590596199,maxY - 0.004910767078399658,maxZ - 0.029223240911960602) 343 | ,(maxX - 0.09112122654914856,maxY - 0.005276918411254883,minZ + 0.02641196921467781) 344 | ,(minX + 0.02370016649365425,maxY - 0.004876226186752319,maxZ - 0.027600344270467758) 345 | ,(maxX - 0.08757998049259186,maxY - 0.005704522132873535,minZ + 0.006317870691418648) 346 | ,(minX + 0.08093622699379921,maxY - 0.004661738872528076,maxZ - 0.01751803606748581) 347 | ,(maxX,maxY - 0.00583687424659729,minZ + 9.720027446746826e-05) 348 | ,(maxX - 0.01277536153793335,maxY - 0.0058175623416900635,minZ + 0.0010046139359474182) 349 | ,(maxX - 0.00027532875537872314,maxY - 0.00566786527633667,minZ + 0.008039364591240883) 350 | ,(maxX - 0.012475311756134033,maxY - 0.005648583173751831,minZ + 0.008946776390075684) 351 | ,(minX + 0.06108579412102699,minY + 0.008226752281188965,maxZ) 352 | ,(minX + 0.0049602799117565155,minY + 0.007466375827789307,maxZ - 0.03573753498494625) 353 | ,(maxX - 0.08414773643016815,minY + 0.007414713501930237,minZ + 0.034679558128118515) 354 | ,(minX + 0.018365193158388138,minY + 0.007873490452766418,maxZ - 0.016602978110313416) 355 | ,(maxX - 0.08009319007396698,minY + 0.0069251954555511475,minZ + 0.011672809720039368) 356 | ,(minX + 0.08389763161540031,minY + 0.008119136095046997,maxZ - 0.005059238523244858) 357 | ,(maxX,minY + 0.00688643753528595,minZ + 0.009851515293121338) 358 | ,(maxX - 0.011683255434036255,minY + 0.006892099976539612,minZ + 0.010117188096046448) 359 | ,(maxX - 0.00027532875537872314,minY + 0.007055431604385376,minZ + 0.017793675884604454) 360 | ,(maxX - 0.01143239438533783,minY + 0.007061079144477844,minZ + 0.018059348687529564) 361 | ,(minX + 0.03807384893298149,minY + 0.008140534162521362,maxZ - 0.004053622484207153) 362 | ,(minX + 1.1175870895385742e-08,minY + 0.007466380018740892,minZ + 0.014226417988538742) 363 | ,(maxX - 0.09669993072748184,minY + 0.007833942770957947,maxZ - 0.018461115658283234) 364 | ,(minX + 0.06108483672142029,minY + 0.014207407832145691,maxZ - 0.00017091631889343262) 365 | ,(minX + 0.0050520338118076324,minY + 0.01344829797744751,maxZ - 0.03584941849112511) 366 | ,(maxX - 0.08423872292041779,minY + 0.01339671015739441,minZ + 0.03457168489694595) 367 | ,(minX + 0.018434803932905197,minY + 0.013854727149009705,maxZ - 0.01674646884202957) 368 | ,(maxX - 0.08019088208675385,minY + 0.0129079669713974,minZ + 0.011602940270677209) 369 | ,(minX + 0.08385899290442467,minY + 0.014099955558776855,maxZ - 0.005221795290708542) 370 | ,(maxX,minY + 0.012868016958236694,minZ + 0.00972424354404211) 371 | ,(maxX - 0.011697500944137573,minY + 0.012873843312263489,minZ + 0.009998289868235588) 372 | ,(maxX - 0.00027532875537872314,minY + 0.01303701102733612,minZ + 0.017666404135525227) 373 | ,(maxX - 0.011445999145507812,minY + 0.013042852282524109,minZ + 0.017940450459718704) 374 | ,(minX + 0.03811090067028999,minY + 0.01412130892276764,maxZ - 0.004217840731143951) 375 | ,(minX,minY + 0.012963816523551941,minZ + 0.014226420782506466) 376 | ,(maxX - 0.09677018225193024,minY + 0.013815224170684814,maxZ - 0.018601536750793457)] 377 | 378 | # Faces 379 | myFaces = [(18, 17, 5, 6),(20, 19, 2, 3),(22, 21, 7, 0),(23, 20, 3, 4),(24, 22, 0, 1) 380 | ,(25, 18, 6, 8),(17, 23, 4, 5),(21, 25, 8, 7),(12, 10, 14, 16),(24, 1, 12, 27) 381 | ,(29, 16, 14, 28),(9, 11, 15, 13),(36, 9, 13, 38),(27, 12, 16, 29),(43, 53, 17, 18) 382 | ,(44, 54, 19, 20),(45, 55, 21, 22),(46, 44, 20, 23),(47, 45, 22, 24),(48, 43, 18, 25) 383 | ,(53, 46, 23, 17),(55, 48, 25, 21),(47, 24, 27, 50),(52, 29, 28, 51),(10, 26, 28, 14) 384 | ,(50, 27, 29, 52),(49, 36, 38, 51),(15, 39, 38, 13),(11, 37, 39, 15),(30, 40, 53, 43) 385 | ,(31, 41, 54, 44),(32, 42, 55, 45),(33, 31, 44, 46),(34, 32, 45, 47),(35, 30, 43, 48) 386 | ,(40, 33, 46, 53),(42, 35, 48, 55),(34, 47, 50, 37),(39, 52, 51, 38),(37, 50, 52, 39) 387 | ,(26, 49, 51, 28)] 388 | 389 | return (myVertex,myFaces,maxX - minX, maxY - minY) 390 | 391 | #---------------------------------------------- 392 | # Tile model 04 393 | #---------------------------------------------- 394 | def tile_model_04(self,context): 395 | #------------------------------------ 396 | # Mesh data 397 | #------------------------------------ 398 | minX = 0 399 | maxX = 0.2706337571144104 400 | minY = -0.0008960736449807882 401 | maxY = 0.4393549859523773 402 | minZ = -0.021988021209836006 403 | maxZ = 0.01913231611251831 404 | 405 | # Vertex 406 | myVertex = [(maxX - 0.0009386539459228516,minY + 9.811518248170614e-05,minZ + 0.009184492751955986) 407 | ,(minX + 2.9802322387695312e-08,minY + 0.0008960723644122481,maxZ - 0.01913231797516346) 408 | ,(maxX,maxY - 0.000797957181930542,minZ + 0.0015743095427751541) 409 | ,(minX + 0.0009386688470840454,maxY,minZ + 0.014377830550074577) 410 | ,(maxX - 0.03795182704925537,minY + 0.00020762975327670574,minZ + 0.010941661894321442) 411 | ,(minX + 0.03701320290565491,minY + 0.0007865577936172485,minZ + 0.020230852998793125) 412 | ,(maxX - 0.037013158202171326,maxY - 0.0006884634494781494,minZ + 0.003331473097205162) 413 | ,(minX + 0.037951841950416565,maxY - 0.00010952353477478027,minZ + 0.01262066513299942) 414 | ,(minX + 0.1184280663728714,minY + 0.000545668532140553,minZ + 0.016365760006010532) 415 | ,(maxX - 0.11936667561531067,minY + 0.00044850551057606936,minZ + 0.014806757681071758) 416 | ,(minX + 0.11936671286821365,maxY - 0.0003504157066345215,minZ + 0.008755568414926529) 417 | ,(maxX - 0.11842802166938782,maxY - 0.0004475712776184082,minZ + 0.007196567952632904) 418 | ,(maxX,minY + 0.010358194587752223,maxZ - 0.012803521938621998) 419 | ,(minX + 0.0009386688470840454,minY + 0.01115613873116672,maxZ) 420 | ,(minX + 0.037951841950416565,minY + 0.011046637548133731,maxZ - 0.0017571654170751572) 421 | ,(maxX - 0.037013158202171326,minY + 0.010467695770785213,maxZ - 0.011046357452869415) 422 | ,(minX + 0.11922238767147064,minY + 0.010617014719173312,maxZ - 0.008650526404380798) 423 | ,(maxX - 0.11857235431671143,minY + 0.010519851697608829,maxZ - 0.010209528729319572) 424 | ,(maxX,maxY - 0.0072495341300964355,minZ + 0.001976391300559044) 425 | ,(minX + 0.037951841950416565,maxY - 0.006561100482940674,minZ + 0.01302274689078331) 426 | ,(maxX - 0.037013158202171326,maxY - 0.007140040397644043,minZ + 0.003733554854989052) 427 | ,(minX + 0.11936454474925995,maxY - 0.006804823875427246,minZ + 0.009112119674682617) 428 | ,(maxX - 0.11843019723892212,maxY - 0.006901979446411133,minZ + 0.007553117349743843) 429 | ,(minX + 0.0009386688470840454,maxY - 0.0064515769481658936,minZ + 0.014779912307858467) 430 | ,(minX + 0.00011220574378967285,minY + 0.0021222709910944104,maxZ - 0.016845770180225372) 431 | ,(maxX - 0.0008264482021331787,minY + 0.0013243272551335394,minZ + 0.011471047066152096) 432 | ,(minX + 0.03712538629770279,minY + 0.002012769808061421,maxZ - 0.01860293745994568) 433 | ,(maxX - 0.0378396213054657,minY + 0.001433828438166529,minZ + 0.013228209689259529) 434 | ,(minX + 0.1185230016708374,minY + 0.0017493232735432684,minZ + 0.018290389329195023) 435 | ,(maxX - 0.11927174031734467,minY + 0.0016521602519787848,minZ + 0.01673138700425625) 436 | ,(maxX,minY + 0.01807751110754907,maxZ - 0.013284613378345966) 437 | ,(minX + 0.037951841950416565,minY + 0.01876595593057573,maxZ - 0.0022382568567991257) 438 | ,(maxX - 0.037013158202171326,minY + 0.01818701229058206,maxZ - 0.011527448892593384) 439 | ,(minX + 0.11922498792409897,minY + 0.01833972311578691,maxZ - 0.009077141061425209) 440 | ,(maxX - 0.1185697615146637,minY + 0.018242560094222426,maxZ - 0.010636141523718834) 441 | ,(minX + 0.0009386688470840454,minY + 0.018875457113608718,maxZ - 0.0004810914397239685) 442 | ,(maxX,maxY - 0.09558254480361938,minZ + 0.007481573149561882) 443 | ,(minX + 0.037951841950416565,maxY - 0.09489411115646362,minZ + 0.018527928739786148) 444 | ,(maxX - 0.037013158202171326,maxY - 0.09547305107116699,minZ + 0.00923873856663704) 445 | ,(minX + 0.1202642098069191,maxY - 0.09396132826805115,maxZ - 0.00762566365301609) 446 | ,(maxX - 0.11753053963184357,maxY - 0.09405851364135742,maxZ - 0.009184665977954865) 447 | ,(minX + 0.0009386688470840454,maxY - 0.09478458762168884,minZ + 0.02028509508818388) 448 | ,(maxX - 0.07891011238098145,minY,minZ + 0.007610190659761429) 449 | ,(maxX - 0.07797147333621979,maxY - 0.0008960962295532227,minZ) 450 | ,(maxX - 0.07804363965988159,minY + 0.010165706044062972,maxZ - 0.0158919645473361) 451 | ,(maxX - 0.07797256112098694,maxY - 0.007349073886871338,minZ + 0.0003793146461248398) 452 | ,(maxX - 0.0788065642118454,minY + 0.0012149333488196135,minZ + 0.009715777821838856) 453 | ,(maxX - 0.07804234325885773,minY + 0.01788672781549394,maxZ - 0.016345815733075142) 454 | ,(maxX - 0.07752272486686707,maxY - 0.09509384632110596,minZ + 0.015323184430599213) 455 | ,(minX + 0.07725311815738678,minY + 5.473045166581869e-05,minZ + 0.008488442748785019) 456 | ,(minX + 0.07819175720214844,maxY - 0.0008413791656494141,minZ + 0.0008782520890235901) 457 | ,(minX + 0.07811960577964783,minY + 0.010220450116321445,maxZ - 0.015013711526989937) 458 | ,(minX + 0.07819066941738129,maxY - 0.007294327020645142,minZ + 0.001257568597793579) 459 | ,(minX + 0.07735666632652283,minY + 0.0012696638295892626,minZ + 0.010594029910862446) 460 | ,(minX + 0.07812090218067169,minY + 0.017941456055268645,maxZ - 0.015467563644051552) 461 | ,(minX + 0.07864050567150116,maxY - 0.09503909945487976,minZ + 0.016201436519622803)] 462 | 463 | # Faces 464 | myFaces = [(20, 18, 2, 6),(23, 19, 7, 3),(45, 20, 6, 43),(52, 21, 10, 50),(21, 22, 11, 10) 465 | ,(27, 25, 12, 15),(24, 26, 14, 13),(46, 27, 15, 44),(53, 28, 16, 51),(28, 29, 17, 16) 466 | ,(38, 36, 18, 20),(41, 37, 19, 23),(48, 38, 20, 45),(55, 39, 21, 52),(39, 40, 22, 21) 467 | ,(4, 0, 25, 27),(1, 5, 26, 24),(42, 4, 27, 46),(49, 8, 28, 53),(8, 9, 29, 28) 468 | ,(15, 12, 30, 32),(13, 14, 31, 35),(44, 15, 32, 47),(51, 16, 33, 54),(16, 17, 34, 33) 469 | ,(32, 30, 36, 38),(35, 31, 37, 41),(47, 32, 38, 48),(54, 33, 39, 55),(33, 34, 40, 39) 470 | ,(22, 45, 43, 11),(29, 46, 44, 17),(40, 48, 45, 22),(9, 42, 46, 29),(17, 44, 47, 34) 471 | ,(34, 47, 48, 40),(19, 52, 50, 7),(26, 53, 51, 14),(37, 55, 52, 19),(5, 49, 53, 26) 472 | ,(14, 51, 54, 31),(31, 54, 55, 37)] 473 | 474 | return (myVertex,myFaces,maxX - minX, maxY - minY) 475 | 476 | #---------------------------------------------- 477 | # Code to run alone the script 478 | #---------------------------------------------- 479 | if __name__ == "__main__": 480 | create_mesh(0) 481 | print("Executed") 482 | -------------------------------------------------------------------------------- /archimesh/src/room_maker.py: -------------------------------------------------------------------------------- 1 | # ***** BEGIN GPL LICENSE BLOCK ***** 2 | # 3 | # 4 | # This program is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU General Public License 6 | # as published by the Free Software Foundation; either version 2 7 | # of the License, or (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software Foundation, 16 | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | # 18 | # ***** END GPL LICENCE BLOCK ***** 19 | 20 | #---------------------------------------------------------- 21 | # File: room_maker.py 22 | # Automatic generation of rooms 23 | # Author: Antonio Vazquez (antonioya) 24 | # 25 | #---------------------------------------------------------- 26 | import bpy 27 | import math 28 | from tools import * 29 | 30 | #------------------------------------------------------------------------------ 31 | # Generate mesh data 32 | # All custom values are passed using self container (self.myvariable) 33 | #------------------------------------------------------------------------------ 34 | def create_mesh(self,context): 35 | # deactivate others 36 | for o in bpy.data.objects: 37 | if (o.select == True): 38 | o.select = False 39 | bpy.ops.object.select_all(False) 40 | # Create room 41 | myRoom = create_room(self,context,"Room",self.room_height) 42 | myRoom.select = True 43 | bpy.context.scene.objects.active = myRoom 44 | 45 | remove_doubles(myRoom) 46 | set_normals(myRoom,not self.inverse) # inside/outside 47 | 48 | if (self.wall_width > 0.0): 49 | set_modifier_solidify(myRoom,self.wall_width) 50 | 51 | # Create baseboard 52 | if (self.baseboard): 53 | myBase = create_room(self,context,"Baseboard",self.base_height,True) 54 | set_normals(myBase,self.inverse) # inside/outside room 55 | if (self.base_width > 0.0): 56 | set_modifier_solidify(myBase,self.base_width) 57 | myBase.parent = myRoom 58 | 59 | # Create floor 60 | if (self.floor): 61 | myFloor = create_floor(self,context,"Floor",myRoom) 62 | myFloor.parent = myRoom 63 | 64 | # Create ceiling 65 | if (self.ceiling): 66 | myCeiling = create_floor(self,context,"Ceiling",myRoom) 67 | myCeiling.parent = myRoom 68 | 69 | # Create materials 70 | if (self.crt_mat): 71 | # Wall material (two faces) 72 | mat = create_diffuse_material("Wall_material",False,0.765, 0.650, 0.588,0.8,0.621,0.570,0.1,True) 73 | set_material(myRoom,mat) 74 | # Baseboard material 75 | if (self.baseboard): 76 | mat = create_diffuse_material("Baseboard_material",False,0.8, 0.8, 0.8) 77 | set_material(myBase,mat) 78 | 79 | # Ceiling material 80 | if (self.ceiling): 81 | mat = create_diffuse_material("Ceiling_material",False,0.95, 0.95, 0.95) 82 | set_material(myCeiling,mat) 83 | 84 | # Floor material 85 | if (self.floor): 86 | mat = create_brick_material("Floor_material",False,0.711, 0.668, 0.668,0.8,0.636,0.315) 87 | set_material(myFloor,mat) 88 | 89 | bpy.ops.object.select_all(False) 90 | myRoom.select = True 91 | bpy.context.scene.objects.active = myRoom 92 | 93 | return 94 | #------------------------------------------------------------------------------ 95 | # Create Room/baseboard 96 | # Some custom values are passed using self container (self.myvariable) 97 | #------------------------------------------------------------------------------ 98 | def create_room(self,context,objName,height,baseboard = False): 99 | 100 | myVertex = [] 101 | myFaces = [] 102 | lastFace = 0 103 | #--------------------------------- 104 | # Horizontal (First) 105 | #--------------------------------- 106 | if (self.wall_num >= 1): 107 | if (self.a01 == False or baseboard == True): 108 | myVertex.extend([(0.0,0.0,0.0),(0.0,0.0,height),(self.w01,0.0,height),(self.w01,0.0,0.0)]) 109 | myFaces.extend([(0,1,2,3)]) 110 | lastFace = 2 111 | lastX = self.w01 112 | lastY = 0.0 113 | else: 114 | mid = self.w01 / 2 + ((self.w01 / 2) * self.f01) 115 | # first 116 | myVertex.extend([(0.0,0.0,0.0) 117 | ,(0.0,0.0,height) 118 | ,(mid,0.0,height + self.m01) 119 | ,(mid,0.0,0.0)]) 120 | if (math.fabs(self.f01) != 1): 121 | myFaces.extend([(0,1,2,3)]) 122 | # second 123 | myVertex.extend([(self.w01,0.0,0.0),(self.w01,0.0,height)]) 124 | if (math.fabs(self.f01) != 1): 125 | myFaces.extend([(2,3,4,5)]) 126 | else: 127 | myFaces.extend([(0,1,5,4),(1,2,5)]) 128 | 129 | lastFace = 4 130 | 131 | lastX = self.w01 132 | lastY = 0.0 133 | 134 | 135 | #--------------------------------- 136 | # Vertical 137 | #--------------------------------- 138 | if (self.wall_num >= 2): 139 | myDat = vertical_wall(self.a01, 140 | self.a02,self.w02,self.m02,self.f02 141 | ,baseboard,lastFace 142 | ,lastX,lastY,height,myVertex,myFaces) 143 | lastY = myDat[0] 144 | lastFace = myDat[1] 145 | 146 | # Horizontal 147 | if (self.wall_num >= 3): 148 | myDat = horizontal_wall(self.a02, 149 | self.a03,self.w03,self.m03,self.f03 150 | ,baseboard,lastFace 151 | ,lastX,lastY,height,myVertex,myFaces) 152 | lastX = myDat[0] 153 | lastFace = myDat[1] 154 | 155 | # Vertical 156 | if (self.wall_num >= 4): 157 | myDat = vertical_wall(self.a03, 158 | self.a04,self.w04,self.m04,self.f04 159 | ,baseboard,lastFace 160 | ,lastX,lastY,height,myVertex,myFaces) 161 | lastY = myDat[0] 162 | lastFace = myDat[1] 163 | 164 | # Horizontal 165 | if (self.wall_num >= 5): 166 | myDat = horizontal_wall(self.a04, 167 | self.a05,self.w05,self.m05,self.f05 168 | ,baseboard,lastFace 169 | ,lastX,lastY,height,myVertex,myFaces) 170 | lastX = myDat[0] 171 | lastFace = myDat[1] 172 | 173 | # Vertical 174 | if (self.wall_num >= 6): 175 | myDat = vertical_wall(self.a05, 176 | self.a06,self.w06,self.m06,self.f06 177 | ,baseboard,lastFace 178 | ,lastX,lastY,height,myVertex,myFaces) 179 | lastY = myDat[0] 180 | lastFace = myDat[1] 181 | 182 | # Horizontal 183 | if (self.wall_num >= 7): 184 | myDat = horizontal_wall(self.a06, 185 | self.a07,self.w07,self.m07,self.f07 186 | ,baseboard,lastFace 187 | ,lastX,lastY,height,myVertex,myFaces) 188 | lastX = myDat[0] 189 | lastFace = myDat[1] 190 | 191 | # Vertical 192 | if (self.wall_num >= 8): 193 | myDat = vertical_wall(self.a07, 194 | self.a08,self.w08,self.m08,self.f08 195 | ,baseboard,lastFace 196 | ,lastX,lastY,height,myVertex,myFaces) 197 | lastY = myDat[0] 198 | lastFace = myDat[1] 199 | 200 | # Horizontal 201 | if (self.wall_num >= 9): 202 | myDat = horizontal_wall(self.a08, 203 | self.a09,self.w09,self.m09,self.f09 204 | ,baseboard,lastFace 205 | ,lastX,lastY,height,myVertex,myFaces) 206 | lastX = myDat[0] 207 | lastFace = myDat[1] 208 | 209 | # Vertical 210 | if (self.wall_num >= 10): 211 | myDat = vertical_wall(self.a09, 212 | self.a10,self.w10,self.m10,self.f10 213 | ,baseboard,lastFace 214 | ,lastX,lastY,height,myVertex,myFaces) 215 | lastY = myDat[0] 216 | lastFace = myDat[1] 217 | 218 | # Horizontal 219 | if (self.wall_num >= 11): 220 | myDat = horizontal_wall(self.a10, 221 | self.a11,self.w11,self.m11,self.f11 222 | ,baseboard,lastFace 223 | ,lastX,lastY,height,myVertex,myFaces) 224 | lastX = myDat[0] 225 | lastFace = myDat[1] 226 | 227 | # Vertical 228 | if (self.wall_num >= 12): 229 | myDat = vertical_wall(self.a11, 230 | self.a12,self.w12,self.m12,self.f12 231 | ,baseboard,lastFace 232 | ,lastX,lastY,height,myVertex,myFaces) 233 | lastY = myDat[0] 234 | lastFace = myDat[1] 235 | 236 | # Horizontal 237 | if (self.wall_num >= 13): 238 | myDat = horizontal_wall(self.a12, 239 | self.a13,self.w13,self.m13,self.f13 240 | ,baseboard,lastFace 241 | ,lastX,lastY,height,myVertex,myFaces) 242 | lastX = myDat[0] 243 | lastFace = myDat[1] 244 | 245 | # Vertical 246 | if (self.wall_num >= 14): 247 | myDat = vertical_wall(self.a13, 248 | self.a14,self.w14,self.m14,self.f14 249 | ,baseboard,lastFace 250 | ,lastX,lastY,height,myVertex,myFaces) 251 | lastY = myDat[0] 252 | lastFace = myDat[1] 253 | 254 | # Horizontal 255 | if (self.wall_num >= 15): 256 | myDat = horizontal_wall(self.a14, 257 | self.a15,self.w15,self.m15,self.f15 258 | ,baseboard,lastFace 259 | ,lastX,lastY,height,myVertex,myFaces) 260 | lastX = myDat[0] 261 | lastFace = myDat[1] 262 | 263 | # Vertical 264 | if (self.wall_num >= 16): 265 | myDat = vertical_wall(self.a15, 266 | self.a16,self.w16,self.m16,self.f16 267 | ,baseboard,lastFace 268 | ,lastX,lastY,height,myVertex,myFaces) 269 | lastY = myDat[0] 270 | lastFace = myDat[1] 271 | 272 | # Horizontal 273 | if (self.wall_num >= 17): 274 | myDat = horizontal_wall(self.a16, 275 | self.a17,self.w17,self.m17,self.f17 276 | ,baseboard,lastFace 277 | ,lastX,lastY,height,myVertex,myFaces) 278 | lastX = myDat[0] 279 | lastFace = myDat[1] 280 | 281 | # Vertical 282 | if (self.wall_num >= 18): 283 | myDat = vertical_wall(self.a17, 284 | self.a18,self.w18,self.m18,self.f18 285 | ,baseboard,lastFace 286 | ,lastX,lastY,height,myVertex,myFaces) 287 | lastY = myDat[0] 288 | lastFace = myDat[1] 289 | 290 | # Horizontal 291 | if (self.wall_num >= 19): 292 | myDat = horizontal_wall(self.a18, 293 | self.a19,self.w19,self.m19,self.f19 294 | ,baseboard,lastFace 295 | ,lastX,lastY,height,myVertex,myFaces) 296 | lastX = myDat[0] 297 | lastFace = myDat[1] 298 | 299 | # Vertical 300 | if (self.wall_num >= 20): 301 | myDat = vertical_wall(self.a19, 302 | self.a20,self.w20,self.m20,self.f20 303 | ,baseboard,lastFace 304 | ,lastX,lastY,height,myVertex,myFaces) 305 | lastY = myDat[0] 306 | lastFace = myDat[1] 307 | 308 | # Close room 309 | if (self.merge == True): 310 | if (baseboard == False): 311 | if ((self.wall_num == 1 and self.a01 == True) 312 | or (self.wall_num == 2 and self.a02 == True) 313 | or (self.wall_num == 3 and self.a03 == True) 314 | or (self.wall_num == 4 and self.a04 == True) 315 | or (self.wall_num == 5 and self.a05 == True) 316 | or (self.wall_num == 6 and self.a06 == True) 317 | or (self.wall_num == 7 and self.a07 == True) 318 | or (self.wall_num == 8 and self.a08 == True) 319 | or (self.wall_num == 9 and self.a09 == True) 320 | or (self.wall_num == 10 and self.a10 == True) 321 | or (self.wall_num == 11 and self.a11 == True) 322 | or (self.wall_num == 12 and self.a12 == True) 323 | or (self.wall_num == 13 and self.a13 == True) 324 | or (self.wall_num == 14 and self.a14 == True) 325 | or (self.wall_num == 15 and self.a15 == True) 326 | or (self.wall_num == 16 and self.a16 == True) 327 | or (self.wall_num == 17 and self.a17 == True) 328 | or (self.wall_num == 18 and self.a18 == True) 329 | or (self.wall_num == 19 and self.a19 == True) 330 | or (self.wall_num == 20 and self.a20 == True)): 331 | myFaces.extend([(0,1,lastFace + 1, lastFace)]) 332 | else: 333 | myFaces.extend([(0,1,lastFace, lastFace + 1)]) 334 | else: 335 | myFaces.extend([(0,1,self.wall_num * 2, self.wall_num * 2 + 1)]) 336 | 337 | 338 | mymesh = bpy.data.meshes.new(objName) 339 | myobject = bpy.data.objects.new(objName, mymesh) 340 | 341 | myobject.location = bpy.context.scene.cursor_location 342 | bpy.context.scene.objects.link(myobject) 343 | 344 | mymesh.from_pydata(myVertex, [], myFaces) 345 | mymesh.update(calc_edges=True) 346 | 347 | return myobject 348 | #------------------------------------------------------------------------------ 349 | # Vertical Wall 350 | #------------------------------------------------------------------------------ 351 | def vertical_wall(prv,advance,size,over,factor,baseboard,lastFace,lastX,lastY,height,myVertex,myFaces): 352 | if (advance == False or baseboard == True): 353 | myVertex.extend([(lastX,size + lastY,height),(lastX,size + lastY,0.0)]) 354 | if (prv == False or baseboard == True): 355 | myFaces.extend([(lastFace,lastFace + 2,lastFace + 3,lastFace + 1)]) # no advance 356 | else: 357 | myFaces.extend([(lastFace,lastFace + 1,lastFace + 2,lastFace + 3)]) # advance 358 | 359 | lastFace = lastFace + 2 360 | else: 361 | mid = size / 2 + ((size / 2) * factor) 362 | # first 363 | myVertex.extend([(lastX,mid + lastY,height + over) 364 | ,(lastX,mid + lastY,0.0)]) 365 | if (math.fabs(factor) != 1): 366 | if (prv == False): 367 | myFaces.extend([(lastFace,lastFace + 2,lastFace + 3,lastFace + 1)]) # no advance 368 | else: 369 | myFaces.extend([(lastFace,lastFace + 1,lastFace + 2,lastFace + 3)]) # advance 370 | # second 371 | myVertex.extend([(lastX,lastY + size,0.0),(lastX,lastY + size,height)]) 372 | if (math.fabs(factor) != 1): 373 | myFaces.extend([(lastFace + 2,lastFace + 3,lastFace + 4,lastFace+ 5)]) 374 | else: 375 | if (prv == False): 376 | myFaces.extend([(lastFace, lastFace + 5, lastFace + 4, lastFace + 1) 377 | ,(lastFace, lastFace + 2, lastFace + 5)]) 378 | else: 379 | myFaces.extend([(lastFace, lastFace + 4, lastFace + 5, lastFace + 1) 380 | ,(lastFace + 1, lastFace + 2, lastFace + 5)]) 381 | 382 | lastFace = lastFace + 4 383 | 384 | lastY = size + lastY 385 | 386 | return (lastY,lastFace) 387 | 388 | #------------------------------------------------------------------------------ 389 | # Horizontal Wall 390 | #------------------------------------------------------------------------------ 391 | def horizontal_wall(prv,advance,size,over,factor,baseboard,lastFace,lastX,lastY,height,myVertex,myFaces): 392 | if (advance == False or baseboard == True): 393 | myVertex.extend([(lastX + size,lastY,height),(lastX + size,lastY,0.0)]) 394 | if (prv == False or baseboard == True): 395 | myFaces.extend([(lastFace,lastFace + 2,lastFace + 3,lastFace + 1)]) # no advance 396 | else: 397 | myFaces.extend([(lastFace,lastFace + 1,lastFace + 2,lastFace + 3)]) # advance 398 | 399 | lastFace = lastFace + 2 400 | else: 401 | mid = size / 2 + ((size / 2) * factor) 402 | # first 403 | myVertex.extend([(mid + lastX,lastY,height + over) 404 | ,(mid + lastX,lastY,0.0)]) 405 | if (math.fabs(factor) != 1): 406 | if (prv == False): 407 | myFaces.extend([(lastFace,lastFace + 2,lastFace + 3,lastFace + 1)]) # no advance 408 | else: 409 | myFaces.extend([(lastFace,lastFace + 1,lastFace + 2,lastFace + 3)]) # advance 410 | # second 411 | myVertex.extend([(lastX + size,lastY,0.0),(lastX + size,lastY,height)]) 412 | if (math.fabs(factor) != 1): 413 | myFaces.extend([(lastFace + 2,lastFace + 3,lastFace + 4,lastFace+ 5)]) 414 | else: 415 | if (prv == False): 416 | myFaces.extend([(lastFace, lastFace + 5, lastFace + 4, lastFace + 1) 417 | ,(lastFace, lastFace + 2, lastFace + 5)]) 418 | else: 419 | myFaces.extend([(lastFace, lastFace + 4, lastFace + 5, lastFace + 1) 420 | ,(lastFace + 1, lastFace + 2, lastFace + 5)]) 421 | 422 | lastFace = lastFace + 4 423 | 424 | lastX = size + lastX 425 | 426 | return (lastX,lastFace) 427 | 428 | #------------------------------------------------------------------------------ 429 | # Create Floor or Ceiling 430 | #------------------------------------------------------------------------------ 431 | def create_floor(self,context,typ,myRoom): 432 | bpy.context.scene.objects.active = myRoom 433 | 434 | myVertex = [] 435 | myFaces = [] 436 | verts = [] 437 | 438 | obverts = bpy.context.active_object.data.vertices 439 | for vertex in obverts: 440 | verts.append(tuple(vertex.co)) 441 | # Loop only selected 442 | i = 0 443 | for e in verts: 444 | if (typ == "Floor"): 445 | if(e[2] == 0.0): 446 | myVertex.extend([(e[0],e[1],e[2])]) 447 | i = i + 1 448 | else: # ceiling 449 | if(e[2] == self.room_height): 450 | myVertex.extend([(e[0],e[1],e[2])]) 451 | i = i + 1 452 | # Create faces 453 | fa = [] 454 | for f in range(0,i): 455 | fa.extend([f]) 456 | 457 | myFaces.extend([fa]) 458 | 459 | 460 | mymesh = bpy.data.meshes.new(typ) 461 | myobject = bpy.data.objects.new(typ, mymesh) 462 | 463 | myobject.location = bpy.context.scene.cursor_location 464 | bpy.context.scene.objects.link(myobject) 465 | 466 | mymesh.from_pydata(myVertex, [], myFaces) 467 | mymesh.update(calc_edges=True) 468 | 469 | return myobject 470 | 471 | #---------------------------------------------- 472 | # Code to run alone the script 473 | #---------------------------------------------- 474 | if __name__ == "__main__": 475 | create_mesh(0) 476 | print("Executed") 477 | -------------------------------------------------------------------------------- /archimesh/src/stairs_maker.py: -------------------------------------------------------------------------------- 1 | # ***** BEGIN GPL LICENSE BLOCK ***** 2 | # 3 | # 4 | # This program is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU General Public License 6 | # as published by the Free Software Foundation; either version 2 7 | # of the License, or (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software Foundation, 16 | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | # 18 | # ***** END GPL LICENCE BLOCK ***** 19 | 20 | #---------------------------------------------------------- 21 | # File: stairs_maker.py 22 | # Automatic generation of stairs 23 | # Author: Antonio Vazquez (antonioya) 24 | # 25 | #---------------------------------------------------------- 26 | import bpy 27 | import mathutils 28 | import math 29 | from tools import * 30 | 31 | #------------------------------------------------------------------------------ 32 | # Generate mesh data 33 | # All custom values are passed using self container (self.myvariable) 34 | #------------------------------------------------------------------------------ 35 | def create_mesh(self,context): 36 | 37 | # deactivate others 38 | for o in bpy.data.objects: 39 | if (o.select == True): 40 | o.select = False 41 | 42 | bpy.ops.object.select_all(False) 43 | 44 | #------------------------ 45 | # Create stairs 46 | #------------------------ 47 | myData = create_stairs(self,context,"Stairs") 48 | myStairs = myData[0] 49 | myStairs.select = True 50 | bpy.context.scene.objects.active = myStairs 51 | remove_doubles(myStairs) 52 | set_normals(myStairs) 53 | set_modifier_mirror(myStairs,"X") 54 | #------------------------ 55 | # Create curve handles 56 | #------------------------ 57 | if (self.curve): 58 | x = myStairs.location.x 59 | y = myStairs.location.y 60 | z = myStairs.location.z 61 | 62 | last = myData[1] 63 | x1 = last[1]# use y 64 | 65 | myP = [((0,0,0),(- 0.25, 0, 0),(0.25, 0, 0)) 66 | ,((x1,0,0),(x1- 0.25, 0, 0),(x1 + 0.25, 0, 0))] # double element 67 | myCurve = create_bezier("Stairs_handle", myP,(x,y,z)) 68 | set_modifier_curve(myStairs,myCurve) 69 | 70 | #------------------------ 71 | # Create materials 72 | #------------------------ 73 | if (self.crt_mat): 74 | # Stairs material 75 | mat = create_diffuse_material("Stairs_material",False,0.8, 0.8, 0.8) 76 | set_material(myStairs,mat) 77 | 78 | 79 | bpy.ops.object.select_all(False) 80 | myStairs.select = True 81 | bpy.context.scene.objects.active = myStairs 82 | 83 | return 84 | #------------------------------------------------------------------------------ 85 | # Create rectangular Stairs 86 | #------------------------------------------------------------------------------ 87 | def create_stairs(self,context,objName): 88 | 89 | myVertex = [] 90 | myFaces = [] 91 | index = 0 92 | 93 | lastPoint = (0,0,0) 94 | for s in range(0,self.step_num): 95 | if (self.model == "1"): 96 | myData = create_rect_step(self,context,lastPoint,myVertex,myFaces,index,s) 97 | if (self.model == "2"): 98 | myData = create_round_step(self,context,lastPoint,myVertex,myFaces,index,s) 99 | index = myData[0] 100 | lastPoint = myData[1] 101 | 102 | mesh = bpy.data.meshes.new(objName) 103 | myobject = bpy.data.objects.new(objName, mesh) 104 | 105 | myobject.location = bpy.context.scene.cursor_location 106 | bpy.context.scene.objects.link(myobject) 107 | 108 | mesh.from_pydata(myVertex, [], myFaces) 109 | mesh.update(calc_edges=True) 110 | 111 | return (myobject,lastPoint) 112 | #------------------------------------------------------------------------------ 113 | # Create rectangular step 114 | #------------------------------------------------------------------------------ 115 | def create_rect_step(self,context,origin,myVertex,myFaces,index,step): 116 | x = origin[0] 117 | y = origin[1] 118 | z = origin[2] 119 | i = index 120 | max_depth = y + self.depth 121 | if (self.back == True): 122 | max_depth = self.depth * self.step_num 123 | 124 | # calculate width (no side gap) 125 | if (self.sizev == False): 126 | width = self.max_width / 2 127 | else: 128 | width = (self.max_width / 2) - (step * (((self.max_width - self.min_width) / 2) / self.step_num)) 129 | 130 | # Vertical Rectangle 131 | myVertex.extend([(x,y,z),(x,y,z + self.height),(x + width,y,z + self.height),(x + width,y,z)]) 132 | val = y + self.thickness 133 | myVertex.extend([(x,val,z),(x,val,z + self.height),(x + width,val,z + self.height),(x + width,val,z)]) 134 | 135 | myFaces.extend([(i+0,i+1,i+2,i+3),(i+4,i+5,i+6,i+7),(i+0,i+3,i+7,i+4) 136 | ,(i+1,i+2,i+6,i+5),(i+0,i+1,i+5,i+4),(i+3,i+2,i+6,i+7)]) 137 | # Side plane 138 | myVertex.extend([(x + width,max_depth,z + self.height),(x + width,max_depth,z)]) 139 | myFaces.extend([(i+7,i+6,i+8,i+9)]) 140 | i = i + 10 141 | # calculate width (side gap) 142 | width = width + self.side_gap 143 | 144 | # Horizontal Rectangle 145 | z = z + self.height 146 | myVertex.extend([(x,y - self.front_gap,z),(x,max_depth,z),(x + width,max_depth,z),(x + width,y - self.front_gap,z)]) 147 | z = z + self.thickness 148 | myVertex.extend([(x,y - self.front_gap,z),(x,max_depth,z),(x + width,max_depth,z),(x + width,y - self.front_gap,z)]) 149 | myFaces.extend([(i+0,i+1,i+2,i+3),(i+4,i+5,i+6,i+7),(i+0,i+3,i+7,i+4) 150 | ,(i+1,i+2,i+6,i+5),(i+3,i+2,i+6,i+7)]) 151 | i = i + 8 152 | # remap origin 153 | y = y + (self.depth * self.shift) 154 | 155 | return (i,(x,y,z)) 156 | #------------------------------------------------------------------------------ 157 | # Create rounded step 158 | #------------------------------------------------------------------------------ 159 | def create_round_step(self,context,origin,myVertex,myFaces,index,step): 160 | x = origin[0] 161 | y = origin[1] 162 | z = origin[2] 163 | i = index 164 | li = [math.radians(270),math.radians(288),math.radians(306),math.radians(324),math.radians(342),math.radians(0)] 165 | 166 | max_width = self.max_width 167 | max_depth = y + self.depth 168 | if (self.back == True): 169 | max_depth = (self.depth) * self.step_num 170 | 171 | 172 | # Resize for width 173 | if (self.sizev == True): 174 | max_width = max_width - (step * ((self.max_width - self.min_width) / self.step_num)) 175 | 176 | 177 | half = max_width / 2 178 | #------------------------------------ 179 | # Vertical 180 | #------------------------------------ 181 | # calculate width 182 | width = half - (half * self.radio) 183 | myRadio = half - width 184 | 185 | myVertex.extend([(x,y,z),(x,y,z + self.height)]) 186 | # Round 187 | for e in li: 188 | pos_x = (math.cos(e) * myRadio) + x + width - myRadio 189 | pos_y = (math.sin(e) * myRadio) + y + myRadio 190 | 191 | myVertex.extend([(pos_x,pos_y,z),(pos_x,pos_y,z + self.height)]) 192 | 193 | # back point 194 | myVertex.extend([(x + width,max_depth,z),(x + width,max_depth,z + self.height)]) 195 | 196 | myFaces.extend([(i,i+1,i+3,i+2),(i+2,i+3,i+5,i+4),(i+4,i+5,i+7,i+6),(i+6,i+7,i+9,i+8) 197 | ,(i+8,i+9,i+11,i+10),(i+10,i+11,i+13,i+12),(i+12,i+13,i+15,i+14)]) 198 | 199 | i = i + 16 200 | #------------------------------------ 201 | # Horizontal 202 | #------------------------------------ 203 | # calculate width gap 204 | width = half + self.front_gap - (half * self.radio) 205 | 206 | z = z + self.height 207 | # Vertical 208 | myVertex.extend([(x,y - self.front_gap,z),(x,y - self.front_gap,z + self.thickness)]) 209 | # Round 210 | for e in li: 211 | pos_x = (math.cos(e) * myRadio) + x + width - myRadio 212 | pos_y = (math.sin(e) * myRadio) + y + myRadio - self.front_gap 213 | 214 | myVertex.extend([(pos_x,pos_y,z),(pos_x,pos_y,z + self.thickness)]) 215 | 216 | # back points 217 | myVertex.extend([(pos_x,max_depth,z),(pos_x,max_depth,z + self.thickness) 218 | ,(x,max_depth,z),(x,max_depth,z + self.thickness)]) 219 | 220 | myFaces.extend([(i,i+1,i+3,i+2),(i+2,i+3,i+5,i+4),(i+4,i+5,i+7,i+6),(i+6,i+7,i+9,i+8) 221 | ,(i+8,i+9,i+11,i+10),(i+10,i+11,i+13,i+12),(i+12,i+13,i+15,i+14) 222 | ,(i,i+2,i+4,i+6,i+8,i+10,i+12,i+14,i+16),(i+1,i+3,i+5,i+7,i+9,i+11,i+13,i+15,i+17) 223 | ,(i+14,i+15,i+17,i+16)]) 224 | 225 | i = i + 18 226 | z = z + self.thickness 227 | 228 | # remap origin 229 | #y = y + (self.depth - myRadio) * self.shift 230 | y = y + (self.depth * self.shift) 231 | 232 | return (i,(x,y,z)) 233 | #------------------------------------------------------------------------------ 234 | # Create bezier curve 235 | #------------------------------------------------------------------------------ 236 | def create_bezier(objName, points, origin): 237 | curvedata = bpy.data.curves.new(name=objName, type='CURVE') 238 | curvedata.dimensions = '3D' 239 | 240 | myObject = bpy.data.objects.new(objName, curvedata) 241 | myObject.location = origin 242 | myObject.rotation_euler[2] = math.radians(90) 243 | 244 | bpy.context.scene.objects.link(myObject) 245 | 246 | polyline = curvedata.splines.new('BEZIER') 247 | polyline.bezier_points.add(len(points)-1) 248 | 249 | 250 | for idx, (knot, h1, h2) in enumerate(points): 251 | point = polyline.bezier_points[idx] 252 | point.co = knot 253 | point.handle_left = h1 254 | point.handle_right = h2 255 | point.handle_left_type = 'FREE' 256 | point.handle_right_type = 'FREE' 257 | 258 | return myObject 259 | #---------------------------------------------- 260 | # Code to run alone the script 261 | #---------------------------------------------- 262 | if __name__ == "__main__": 263 | create_mesh(0) 264 | print("Executed") 265 | -------------------------------------------------------------------------------- /archimesh/src/tools.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WhaleCodeObi/blender/7fff54584623371053d860468a35c713b94ec3dd/archimesh/src/tools.py -------------------------------------------------------------------------------- /doc_scenes/Doc_scenes_userguide.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WhaleCodeObi/blender/7fff54584623371053d860468a35c713b94ec3dd/doc_scenes/Doc_scenes_userguide.pdf -------------------------------------------------------------------------------- /doc_scenes/doc_scenes_0.2.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WhaleCodeObi/blender/7fff54584623371053d860468a35c713b94ec3dd/doc_scenes/doc_scenes_0.2.zip -------------------------------------------------------------------------------- /doc_scenes/src/__init__.py: -------------------------------------------------------------------------------- 1 | # ***** BEGIN GPL LICENSE BLOCK ***** 2 | # 3 | # 4 | # This program is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU General Public License 6 | # as published by the Free Software Foundation; either version 2 7 | # of the License, or (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software Foundation, 16 | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | # 18 | # ***** END GPL LICENCE BLOCK ***** 19 | 20 | 21 | #---------------------------------------------------------- 22 | # File: __init__.py 23 | # Author: Antonio Vazquez (antonioya) 24 | #---------------------------------------------------------- 25 | 26 | #---------------------------------------------- 27 | # Define Addon info 28 | #---------------------------------------------- 29 | bl_info = { 30 | "name": "Create html documentation", 31 | "author": "Antonio Vazquez (antonioya)", 32 | "location": "File > Import-Export", 33 | "version": (0, 2), 34 | "blender": (2, 6, 8), 35 | "description": "Create html documentation for blend files, including storyboards, images and linked assets.", 36 | "category": "Import-Export"} 37 | 38 | import sys,os 39 | 40 | #---------------------------------------------- 41 | # Add to Phyton path (once only) 42 | #---------------------------------------------- 43 | path = sys.path 44 | flag = False 45 | for item in path: 46 | if "doc_scenes" in item: 47 | flag = True 48 | if flag == False: 49 | sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'doc_scenes')) 50 | print("doc_scenes: added to phytonpath") 51 | 52 | #---------------------------------------------- 53 | # Import modules 54 | #---------------------------------------------- 55 | if "bpy" in locals(): 56 | import imp 57 | imp.reload(html_maker) 58 | print("doc_scenes: Reloaded multifiles") 59 | else: 60 | from . import html_maker 61 | print("doc_scenes: Imported multifiles") 62 | 63 | import bpy 64 | 65 | from bpy.props import * 66 | from bpy_extras.io_utils import ExportHelper, ImportHelper 67 | 68 | #---------------------------------------------------------- 69 | # Export menu UI 70 | #---------------------------------------------------------- 71 | 72 | class EXPORT_html_doc(bpy.types.Operator, ExportHelper): 73 | bl_idname = "io_export_h.doc_scenes" 74 | bl_description = 'Create html documentation (.html)' 75 | bl_label = "Create html" 76 | bl_space_type = "PROPERTIES" 77 | bl_region_type = "WINDOW" 78 | 79 | # From ExportHelper. Filter filenames. 80 | filename_ext = ".htm" 81 | filter_glob = StringProperty(default="*.htm", options={'HIDDEN'}) 82 | 83 | filepath = bpy.props.StringProperty( 84 | name="File Path", 85 | description="File path used for creating html documentation.", 86 | maxlen= 1024, default= "") 87 | 88 | include_render = bpy.props.BoolProperty( 89 | name = "Renders stored in slots", 90 | description="Include a render example in documentation. All slots will be included in the documentation." 91 | + " Warning: if not exist, a default OpenGl will be created.", 92 | default = True) 93 | 94 | only_render = bpy.props.BoolProperty( 95 | name = "Only render objects", 96 | description="Hide controlers for OpenGL renders.", 97 | default = True) 98 | 99 | include_story = bpy.props.EnumProperty(items = (('2',"Two keframes by line",""), 100 | ('1',"One keyframe by line",""), 101 | ('3',"Keyframe and Notes",""), 102 | ('0',"None","")), 103 | name="Storyboard", 104 | description="Include a OpenGL render for each keyframe.") 105 | 106 | threshold = bpy.props.IntProperty( 107 | name = "threshold", 108 | description="threshold between keyframes in storyboard.", 109 | default = 1, min = 1, max = 25) 110 | 111 | include_images = bpy.props.BoolProperty( 112 | name = "Images thumbnails", 113 | description="Include a table with all images used.", 114 | default = True) 115 | 116 | include_links = bpy.props.BoolProperty( 117 | name = "Linked files", 118 | description="Include a table with all linked files.", 119 | default = True) 120 | 121 | 122 | typecolor = bpy.props.EnumProperty(items = (('#336699',"Blue",""), 123 | ('#CC9900',"Orange",""), 124 | ('#336633',"Green",""), 125 | ('#FFFFCC',"Yellow",""), 126 | ('#990000',"Red",""), 127 | ('#999999',"Gray",""), 128 | ('#666666',"Dark gray",""), 129 | ('#FFFFFF',"White","")), 130 | name="Background", 131 | description="Defines the background color used to generate documentation") 132 | 133 | webserver = bpy.props.BoolProperty( 134 | name = "Optimize for webserver", 135 | description="OPtimize folder structure for deploying to webservers", 136 | default = False) 137 | 138 | include_borders = bpy.props.BoolProperty( 139 | name = "Table borders", 140 | description="Include borders in documentation tables.", 141 | default = False) 142 | 143 | 144 | #---------------------------------------------------------- 145 | # Execute 146 | #---------------------------------------------------------- 147 | def execute(self, context): 148 | print("doc_scenes:", self.properties.filepath) 149 | #from . import simple_obj_export 150 | html_maker.write_html( 151 | self.properties.filepath, 152 | self.include_render, 153 | self.only_render, 154 | self.include_story, 155 | self.threshold, 156 | self.include_images, 157 | self.include_links, 158 | self.typecolor, 159 | self.webserver, 160 | self.include_borders) 161 | return {'FINISHED'} 162 | #---------------------------------------------------------- 163 | # Invoke 164 | #---------------------------------------------------------- 165 | def invoke(self, context, event): 166 | context.window_manager.fileselect_add(self) 167 | return {'RUNNING_MODAL'} 168 | 169 | #---------------------------------------------------------- 170 | # Registration 171 | #---------------------------------------------------------- 172 | def menu_func_export(self, context): 173 | self.layout.operator(EXPORT_html_doc.bl_idname, text="Create scene documentation (.htm)",icon='URL') 174 | 175 | def register(): 176 | bpy.utils.register_module(__name__) 177 | bpy.types.INFO_MT_file_export.append(menu_func_export) 178 | 179 | def unregister(): 180 | bpy.utils.unregister_module(__name__) 181 | bpy.types.INFO_MT_file_export.remove(menu_func_export) 182 | 183 | if __name__ == "__main__": 184 | register() 185 | -------------------------------------------------------------------------------- /doc_scenes/src/html_maker.py: -------------------------------------------------------------------------------- 1 | # ***** BEGIN GPL LICENSE BLOCK ***** 2 | # 3 | # 4 | # This program is free software; you can redistribute it and/or 5 | # modify it under the terms of the GNU General Public License 6 | # as published by the Free Software Foundation; either version 2 7 | # of the License, or (at your option) any later version. 8 | # 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | # GNU General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU General Public License 15 | # along with this program; if not, write to the Free Software Foundation, 16 | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | # 18 | # ***** END GPL LICENCE BLOCK ***** 19 | 20 | #---------------------------------------------------------- 21 | # File: html_maker.py 22 | # Create HTML documentation of blend file. 23 | # Author: Antonio Vazquez (antonioya) 24 | # 25 | # Version info 26 | # ================================================ 27 | # 0.1 Initial version (alpha) 28 | #---------------------------------------------------------- 29 | import bpy 30 | import os 31 | import datetime 32 | import time 33 | 34 | global pathImages 35 | global pathImagesHtml 36 | global pathStyle 37 | global pathStyleHtml 38 | 39 | #------------------------------------------------------------------------------ 40 | # Generate HTML file 41 | #------------------------------------------------------------------------------ 42 | def write_html(outpath,include_render,only_render,include_story,threshold,include_images 43 | ,include_links,typecolor,webserver,include_borders): 44 | #------------------------------- 45 | # extract path and filename 46 | #------------------------------- 47 | (filepath, filename) = os.path.split(outpath) 48 | print("=====================================================") 49 | print('Exporting %s' % filename) 50 | #------------------------------- 51 | # Create output directories 52 | #------------------------------- 53 | # Images 54 | global pathImagesHtml 55 | pathImagesHtml = "img_" + get_filename(filename.replace(" ","_")).lower() 56 | directory = os.path.join(filepath,pathImagesHtml) 57 | 58 | global pathImages 59 | pathImages = directory 60 | 61 | if not os.path.exists(directory): 62 | os.makedirs(directory) 63 | 64 | # Styles 65 | # if webserver, put style outside images 66 | global pathStyleHtml 67 | if (webserver == False): 68 | directory = os.path.join(directory,"style") 69 | pathStyleHtml = pathImagesHtml + "/style" 70 | else: 71 | directory = os.path.join(filepath,"style") 72 | pathStyleHtml = "style" 73 | 74 | global pathStyle 75 | pathStyle = directory 76 | 77 | if not os.path.exists(directory): 78 | os.makedirs(directory) 79 | 80 | #------------------------------- 81 | # copy style sheet to style 82 | #------------------------------- 83 | fromcss = os.path.join(os.path.dirname(__file__), "template/images","doc_style.css") 84 | tocss = os.path.join(pathStyle ,"doc_style.css") 85 | copy_binfile(fromcss,tocss) 86 | 87 | #------------------------------- 88 | # copy support images to style 89 | #------------------------------- 90 | fromimg = os.path.join(os.path.dirname(__file__), "template/images") 91 | copy_binfile(os.path.join(fromimg,"top_area.png"),os.path.join(pathStyle,"top_area.png")) 92 | copy_binfile(os.path.join(fromimg,"mid_area.png"),os.path.join(pathStyle,"mid_area.png")) 93 | copy_binfile(os.path.join(fromimg,"bottom_area.png"),os.path.join(pathStyle,"bottom_area.png")) 94 | copy_binfile(os.path.join(fromimg,"whitenoise.png"),os.path.join(pathStyle,"whitenoise.png")) 95 | copy_binfile(os.path.join(fromimg,"c.gif"),os.path.join(pathStyle,"c.gif")) 96 | 97 | #------------------------------- 98 | # export the images 99 | # to a new folder 100 | #------------------------------- 101 | if (include_images == True): 102 | export_images(pathImages) 103 | #------------------------------- 104 | # Open output file 105 | #------------------------------- 106 | realpath = os.path.realpath(os.path.expanduser(outpath)) 107 | fOut = open(realpath, 'w') 108 | 109 | #------------------------------- 110 | # generate html 111 | #------------------------------- 112 | fInput = open( os.path.join(os.path.dirname(__file__), "template","doc_template.htm")) 113 | line = fInput.readline() 114 | while line: 115 | if ("" in line): 116 | html_title(fOut,line) 117 | elif ("" in line): 118 | html_style(fOut,line) 119 | elif ("" in line): 120 | html_bckcolor(fOut,line,typecolor) 121 | elif ("" in line): 122 | html_info(filepath,fOut) 123 | elif ("" in line): 124 | if (include_render == True): 125 | html_render(pathImages,fOut,filename,only_render) 126 | elif ("" in line): 127 | if (int(include_story) > 0): 128 | html_storyboard(pathImages,fOut,filename,only_render,include_story,threshold) 129 | elif ("" in line): 130 | if (include_images == True): 131 | html_images(pathImages,fOut,include_borders) 132 | elif ("" in line): 133 | if (include_links == True): 134 | html_links(filepath,fOut,include_borders) 135 | elif ("" in line): 136 | html_time(fOut,line,typecolor) 137 | else: 138 | fOut.write(line) 139 | line = fInput.readline() 140 | fInput.close() 141 | 142 | fOut.close() 143 | print('%s successfully exported' % realpath) 144 | print("=====================================================") 145 | 146 | return 147 | #------------------------------------- 148 | # Copy bin file 149 | #------------------------------------- 150 | def copy_binfile(fromfile, tofile): 151 | with open(fromfile,'rb') as f1: 152 | with open(tofile,'wb') as f2: 153 | while True: 154 | bytes=f1.read(1024) 155 | if bytes: 156 | n=f2.write(bytes) 157 | else: 158 | break 159 | #------------------------------------- 160 | # Get Color mode function 161 | #------------------------------------- 162 | def find_color_mode(image): 163 | if not isinstance(image, bpy.types.Image): 164 | raise(TypeError) 165 | else: 166 | #if image.depth <= 8: 167 | # return 'BW' 168 | if image.depth <= 8: 169 | return 'RGB' 170 | else: 171 | return 'RGBA' 172 | #------------------------------------- 173 | # Set only render status 174 | #------------------------------------- 175 | def set_only_render(status): 176 | screen = bpy.context.screen 177 | 178 | v3d = False 179 | # get spaceview_3d in current screen 180 | for a in screen.areas: 181 | if a.type == 'VIEW_3D': 182 | for s in a.spaces: 183 | if s.type == 'VIEW_3D': 184 | v3d = s 185 | break 186 | 187 | if v3d != False: 188 | s.show_only_render = status 189 | #------------------------------------- 190 | # Get file name (no extension) 191 | #------------------------------------- 192 | def get_filename(filepath): 193 | return os.path.splitext(filepath)[0] 194 | #------------------------------------- 195 | # Set viewport to camera 196 | #------------------------------------- 197 | def setCameraView(): 198 | for area in bpy.context.screen.areas: 199 | if area.type == 'VIEW_3D': 200 | area.spaces[0].region_3d.view_perspective = 'CAMERA' 201 | 202 | #------------------------------------------ 203 | # Adjust aspect ratio to new size 204 | # 205 | # width/height define original image size 206 | # 207 | # sizeX/Y define the maximum box 208 | # for final image 209 | # 210 | # Return new image sizes. 211 | #------------------------------------------ 212 | def ratio(width,height,sizeX=128, sizeY=128): 213 | renderX = sizeX 214 | renderY = sizeY 215 | 216 | # avoid errors 217 | if (width == 0): 218 | width = 128 219 | 220 | if (height == 0): 221 | height = 128 222 | 223 | if (width > height): 224 | renderY = (height * renderX) / width 225 | else: 226 | renderX = (width * renderY) / height 227 | 228 | return [int(renderX),int(renderY)] 229 | #------------------------------------- 230 | # Update title 231 | #------------------------------------- 232 | def html_title(fHandle,line): 233 | (filepath, filename) = os.path.split(bpy.data.filepath) 234 | line = line.replace("","Blend file: " + filename) 235 | fHandle.write(line) 236 | #------------------------------------- 237 | # Update back color 238 | #------------------------------------- 239 | def html_bckcolor(fHandle,line,typecolor): 240 | line = line.replace("",typecolor) 241 | fHandle.write(line) 242 | #------------------------------------- 243 | # Update style location 244 | #------------------------------------- 245 | def html_style(fHandle,line): 246 | line = line.replace("",pathStyleHtml) 247 | fHandle.write(line) 248 | #------------------------------------- 249 | # Update time 250 | #------------------------------------- 251 | def html_time(fHandle,line,typecolor): 252 | ts = time.time() 253 | st = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S') 254 | fHandle.write("\n") 255 | fHandle.write("Created by doc_scenes Addon on " + st + "   \n") 256 | fHandle.write("\n") 257 | #------------------------------------- 258 | # Create info table 259 | #------------------------------------- 260 | def html_info(rootpath,fHandle): 261 | fHandle.write("
  Blend information\n") 262 | #------------------- 263 | # Table header 264 | #------------------- 265 | fHandle.write("\n") 266 | fHandle.write("\n") 267 | fHandle.write("\n") 268 | fHandle.write(" \n") 269 | fHandle.write("\n") 270 | fHandle.write("\n") 271 | fHandle.write(" \n") 300 | fHandle.write("\n") 301 | fHandle.write("\n") 302 | fHandle.write(" \n") 303 | fHandle.write("\n") 304 | fHandle.write("
\n") 272 | fHandle.write(" \n") 273 | # blend name 274 | (filepath, filename) = os.path.split(bpy.data.filepath) 275 | fHandle.write(" \n") 276 | fHandle.write(" \n") 277 | fHandle.write(" \n") 278 | # scene name 279 | current_scene = bpy.context.scene 280 | fHandle.write(" \n") 281 | fHandle.write(" \n") 286 | fHandle.write(" \n") 287 | fHandle.write(" \n") 288 | fHandle.write(" \n") 293 | fHandle.write(" \n") 294 | fHandle.write(" \n") 295 | #------------------- 296 | # Table foot 297 | #------------------- 298 | fHandle.write("
File: " + filename + "
Scene: " + current_scene.name) 282 | fHandle.write("   Start: " + str(current_scene.frame_start)) 283 | fHandle.write("   End: " + str(current_scene.frame_end)) 284 | fHandle.write("   FPS: " + str(current_scene.render.fps)) 285 | fHandle.write("
Render: " + current_scene.render.engine) 289 | fHandle.write("   Render size: " + str(current_scene.render.resolution_x) 290 | + " * " 291 | + str(current_scene.render.resolution_y)) 292 | fHandle.write("  
\n") 299 | fHandle.write("
\n") 305 | fHandle.write("\n") 306 | #------------------------------------- 307 | # Create render table 308 | #------------------------------------- 309 | def html_render(rootpath,fHandle,filehtm,only_render): 310 | current_scene = bpy.context.scene 311 | fHandle.write("  Render example\n") 312 | #------------------- 313 | # Table header 314 | #------------------- 315 | fHandle.write("\n") 316 | fHandle.write("\n") 317 | fHandle.write("\n") 318 | fHandle.write(" \n") 319 | fHandle.write("\n") 320 | fHandle.write("\n") 321 | fHandle.write(" \n") 408 | fHandle.write("\n") 409 | fHandle.write("\n") 410 | fHandle.write(" \n") 411 | fHandle.write("\n") 412 | fHandle.write("
\n") 322 | fHandle.write(" \n") 323 | #-------------------------- 324 | # Image (export and table) 325 | #-------------------------- 326 | flagRender = False 327 | try: 328 | oldSlot = bpy.data.images['Render Result'].render_slot 329 | except: 330 | oldSlot = 0 331 | 332 | for num in range(0,8): 333 | try: 334 | bpy.data.images['Render Result'].render_slot = num 335 | image = bpy.data.images['Render Result'] 336 | filesave = "render_slot_" + str(num) + "_" + os.path.splitext(filehtm)[0].lower() +".png" 337 | save_image(pathImages,filesave,image) 338 | if (os.path.exists(rootpath + "/" + pathImages + "/"+ os.path.splitext(filesave)[0].lower() + ".png")): 339 | z = ratio(current_scene.render.resolution_x 340 | ,current_scene.render.resolution_y 341 | ,960,600) 342 | fHandle.write(" \n") 343 | fHandle.write(" \n") 348 | fHandle.write(" \n") 349 | flagRender = True 350 | except: 351 | print("slot " + str(num) + " empty.") 352 | try: 353 | bpy.data.images['Render Result'].render_slot = oldSlot 354 | except: 355 | flagRender= False 356 | 357 | # No render (create OpenGL) 358 | if (flagRender == False): 359 | try: 360 | print("Render default openGL in slot 8...") 361 | bpy.data.images['Render Result'].render_slot = 7 362 | 363 | if (only_render == True): 364 | set_only_render(True) 365 | 366 | setCameraView() 367 | bpy.ops.render.opengl() 368 | 369 | if (only_render == True): 370 | set_only_render(False) 371 | 372 | image = bpy.data.images['Render Result'] 373 | filesave = "render_slot_" + str(num) + "_" + os.path.splitext(filehtm)[0].lower() +".png" 374 | save_image(rootpath,filesave,image) 375 | 376 | z = ratio(current_scene.render.resolution_x 377 | ,current_scene.render.resolution_y 378 | ,960,600) 379 | fHandle.write(" \n") 380 | fHandle.write(" \n") 385 | fHandle.write(" \n") 386 | flagRender = True 387 | except: 388 | print("slot " + str(num) + " empty.") 389 | 390 | try: 391 | bpy.data.images['Render Result'].render_slot = oldSlot 392 | except: 393 | print("no render found") 394 | # No render, add white noise 395 | if (flagRender == False): 396 | z = ratio(960,600,960,600) 397 | fHandle.write(" \n") 398 | fHandle.write(" \n") 402 | fHandle.write(" \n") 403 | #------------------- 404 | # Table foot 405 | #------------------- 406 | fHandle.write("
" 344 | + "" 345 | + "
" 381 | + "" 382 | + "
" 399 | + "" 400 | + "
\n") 407 | fHandle.write("
\n") 413 | fHandle.write("\n") 414 | #------------------------------------- 415 | # Verify if exist in list 416 | #------------------------------------- 417 | def existinlist(list,element): 418 | for l in list: 419 | if (l == element): 420 | return True 421 | 422 | return False 423 | #------------------------------------- 424 | # Create storyboard table 425 | #------------------------------------- 426 | def html_storyboard(rootpath,fHandle,filehtm,only_render,include_story,threshold): 427 | current_scene = bpy.context.scene 428 | f = current_scene.frame_start 429 | t = current_scene.frame_end 430 | print("Generating storyboard with a threshold of " + str(threshold) + " keyframes.") 431 | 432 | #------------------- 433 | # Get keyframe list 434 | #------------------- 435 | klist = [] 436 | for a in bpy.data.actions: 437 | for curve in a.fcurves: 438 | keyframePoints = curve.keyframe_points 439 | for keyframe in keyframePoints: 440 | if (existinlist(klist,keyframe.co[0]) == False): 441 | k = int(keyframe.co[0]) 442 | if ( k >= f and k <= t): 443 | klist.append(k) 444 | klist.sort() 445 | if (len(klist) == 0): 446 | return 447 | 448 | fHandle.write("  Storyboard(Camera: " + current_scene.camera.name + ")\n") 449 | #------------------- 450 | # Table header 451 | #------------------- 452 | fHandle.write("\n") 453 | fHandle.write("\n") 454 | fHandle.write("\n") 455 | fHandle.write(" \n") 456 | fHandle.write("\n") 457 | fHandle.write("\n") 458 | fHandle.write(" \n") 550 | fHandle.write("\n") 551 | fHandle.write("\n") 552 | fHandle.write(" \n") 553 | fHandle.write("\n") 554 | fHandle.write("
\n") 459 | fHandle.write(" \n") 460 | #-------------------------- 461 | # Image (export and table) 462 | #-------------------------- 463 | oldSlot = bpy.data.images['Render Result'].render_slot 464 | if (only_render == True): 465 | set_only_render(True) 466 | 467 | current_scene = bpy.context.scene 468 | oldframe = bpy.context.scene.frame_current 469 | 470 | x = 0 471 | # apply threshold to reduce number of keyframes 472 | nextframe = klist[0] 473 | i = 1 474 | for e in klist: 475 | try: 476 | if (e >= nextframe or i == len(klist)): 477 | nextframe = e + threshold 478 | 479 | print("Storyboard keyframe: " + str(e)) 480 | current_scene.frame_set(e) 481 | bpy.data.images['Render Result'].render_slot = 7 482 | setCameraView() 483 | bpy.ops.render.opengl() 484 | image = bpy.data.images['Render Result'] 485 | filesave = "frame_" + str(e) + "_" + os.path.splitext(filehtm)[0].lower() +".png" 486 | save_image(rootpath,filesave,image) 487 | if (os.path.exists(rootpath + "/" + os.path.splitext(filesave)[0].lower() + ".png")): 488 | # Select size of frame 489 | if (int(include_story) != 1): 490 | z = ratio(current_scene.render.resolution_x 491 | ,current_scene.render.resolution_y 492 | ,450,275) 493 | else: 494 | z = ratio(current_scene.render.resolution_x 495 | ,current_scene.render.resolution_y 496 | ,600,365) 497 | 498 | 499 | if (x % 2 == 0): 500 | fHandle.write(" \n") 501 | 502 | sec = (e / current_scene.render.fps) 503 | sectxt = "%0.03f" % (sec) 504 | fHandle.write(" \n") 512 | # 1 by row 513 | if (int(include_story) == 1): 514 | x = x + 1 515 | # Notes Box 516 | if (int(include_story) == 3): 517 | fHandle.write(" \n") 520 | x = x + 1 521 | 522 | if (x % 2 != 0): 523 | fHandle.write(" \n") 524 | 525 | x = x + 1 526 | else: 527 | print("Omitted storyboard keyframe: " + str(e)) 528 | # add 1 to keyframe for threshold 529 | i = i + 1 530 | except: 531 | print("Error in storyboard.") 532 | 533 | # close table (if even) 534 | if (x % 2 == 0 and int(include_story) == 2): 535 | fHandle.write(" \n") 536 | 537 | 538 | # back to old configuration 539 | bpy.data.images['Render Result'].render_slot = oldSlot 540 | current_scene.frame_set(oldframe) 541 | 542 | if (only_render == True): 543 | set_only_render(False) 544 | 545 | #------------------- 546 | # Table foot 547 | #------------------- 548 | fHandle.write("
" 505 | + "" 506 | + "" 509 | + "
Keyframe: " + str(e) 510 | + " (" + sectxt + " sec.)" 511 | + "
" 518 | + "Notes:
" 519 | + "
\n") 549 | fHandle.write("
\n") 555 | fHandle.write("\n") 556 | #------------------------------------- 557 | # Create images table 558 | #------------------------------------- 559 | def html_images(rootpath,fHandle,include_borders): 560 | fHandle.write("  Images\n") 561 | #------------------- 562 | # Table header 563 | #------------------- 564 | fHandle.write("\n") 565 | fHandle.write("\n") 566 | fHandle.write("\n") 567 | fHandle.write(" \n") 568 | fHandle.write("\n") 569 | fHandle.write("\n") 570 | fHandle.write(" \n") 621 | fHandle.write("\n") 622 | fHandle.write("\n") 623 | fHandle.write(" \n") 624 | fHandle.write("\n") 625 | fHandle.write("
\n") 571 | if (include_borders == True): 572 | fHandle.write(" \n") 573 | else: 574 | fHandle.write("
\n") 575 | # headers 576 | fHandle.write(" \n") 577 | fHandle.write(" \n") 578 | fHandle.write(" \n") 579 | fHandle.write(" \n") 580 | fHandle.write(" \n") 581 | fHandle.write(" \n") 582 | fHandle.write(" \n") 583 | fHandle.write(" \n") 584 | #------------------- 585 | # Loop 586 | #------------------- 587 | flagImg = False 588 | imgs = bpy.data.images 589 | for image in imgs: 590 | if (image.name != "Render Result" and image.name != "Viewer Node"): 591 | (filepath, filename) = os.path.split("//.." + image.filepath) 592 | fHandle.write(" \n") 593 | z = ratio(image.size[0],image.size[1]) 594 | filesave = os.path.splitext(filename)[0] + ".png" 595 | fHandle.write(" \n") 599 | fHandle.write(" \n") 600 | fHandle.write(" \n") 601 | fHandle.write(" \n") 602 | fHandle.write(" \n") 603 | if (image.is_library_indirect): 604 | fHandle.write(" \n") 605 | else: 606 | fHandle.write(" \n") 607 | fHandle.write(" \n") 608 | flagImg = True 609 | 610 | # NO images (message) 611 | if (flagImg == False): 612 | fHandle.write(" \n") 613 | fHandle.write(" ") 614 | fHandle.write(" \n") 615 | 616 | #------------------- 617 | # Table foot 618 | #------------------- 619 | fHandle.write("
ImageNameFormatSizePathLinked
" 596 | + "" 597 | + "" + image.name + "" + image.file_format + "" + str(image.size[0]) + "*" + str(image.size[1]) + "" + image.filepath + "YesNo
** No images found in blend file **
\n") 620 | fHandle.write("
\n") 626 | fHandle.write("\n") 627 | #------------------------------------- 628 | # Create links table 629 | #------------------------------------- 630 | def html_links(rootpath,fHandle,include_borders): 631 | fHandle.write("  Linked files\n") 632 | #------------------- 633 | # Table header 634 | #------------------- 635 | fHandle.write("\n") 636 | fHandle.write("\n") 637 | fHandle.write("\n") 638 | fHandle.write(" \n") 639 | fHandle.write("\n") 640 | fHandle.write("\n") 641 | fHandle.write(" \n") 672 | fHandle.write("\n") 673 | fHandle.write("\n") 674 | fHandle.write(" \n") 675 | fHandle.write("\n") 676 | fHandle.write("
\n") 642 | 643 | if (include_borders == True): 644 | fHandle.write(" \n") 645 | else: 646 | fHandle.write("
\n") 647 | 648 | # headers 649 | fHandle.write(" \n") 650 | fHandle.write(" \n") 651 | fHandle.write(" \n") 652 | #------------------- 653 | # Loop 654 | #------------------- 655 | libs = bpy.data.libraries 656 | for lib in libs: 657 | fHandle.write(" \n") 658 | fHandle.write(" \n") 659 | fHandle.write(" \n") 660 | 661 | # NO Links (message) 662 | if (len(libs) == 0): 663 | fHandle.write(" \n") 664 | fHandle.write(" ") 665 | fHandle.write(" \n") 666 | 667 | #------------------- 668 | # Table foot 669 | #------------------- 670 | fHandle.write("
Path
" + lib.filepath + "
** No linked files found in blend file **
\n") 671 | fHandle.write("
\n") 677 | fHandle.write("\n") 678 | #------------------------------------- 679 | # Save image to file 680 | #------------------------------------- 681 | def save_image(rootpath, filename,image): 682 | try: 683 | filepath = rootpath + "/" + os.path.splitext(filename)[0] + ".png" 684 | 685 | # Save old info 686 | settings = bpy.context.scene.render.image_settings 687 | format = settings.file_format 688 | mode = settings.color_mode 689 | depth = settings.color_depth 690 | 691 | # Apply new info and save 692 | settings.file_format = 'PNG' 693 | settings.color_mode = find_color_mode(image) 694 | settings.color_depth = '8' 695 | image.save_render(filepath) 696 | 697 | # Restore old info 698 | settings.file_format = format 699 | settings.color_mode = mode 700 | settings.color_depth = depth 701 | except: 702 | return 703 | #print("Unable to save") 704 | #------------------------------------- 705 | # Export images to folder 706 | #------------------------------------- 707 | def export_images(rootpath): 708 | print("\nExporting images...") 709 | imgs = bpy.data.images 710 | for image in imgs: 711 | name = image.name 712 | if (name != "Render Result" and name != "Viewer Node"): 713 | (filepath, filename) = os.path.split("//.." + image.filepath) 714 | w = image.size[0] 715 | h = image.size[1] 716 | 717 | print("Image:" + name) 718 | print(' width: %d' % w) 719 | print(' height: %d' % h) 720 | save_image(rootpath,filename,image) 721 | 722 | #---------------------------------------------- 723 | # Code to run alone the script 724 | #---------------------------------------------- 725 | if __name__ == "__main__": 726 | write_html("c:/tmp/html/test.htm", True) 727 | print("Executed") -------------------------------------------------------------------------------- /doc_scenes/template/doc_template.htm: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | <!--TITLE--> 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | -------------------------------------------------------------------------------- /doc_scenes/template/images/bottom_area.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WhaleCodeObi/blender/7fff54584623371053d860468a35c713b94ec3dd/doc_scenes/template/images/bottom_area.png -------------------------------------------------------------------------------- /doc_scenes/template/images/c.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WhaleCodeObi/blender/7fff54584623371053d860468a35c713b94ec3dd/doc_scenes/template/images/c.gif -------------------------------------------------------------------------------- /doc_scenes/template/images/doc_style.css: -------------------------------------------------------------------------------- 1 | BODY { FONT: 11px arial, verdana, sans-serif; 2 | scrollbar-base-color: #909099; 3 | scrollbar-track-color: #909099; 4 | scrollbar-face-color: #909099; 5 | scrollbar-highlight-color: #FFFFFF; 6 | scrollbar-3dlight-color: #4E172A; 7 | scrollbar-darkshadow-color: #4E172A; 8 | scrollbar-shadow-color: #FFFFFF; 9 | scrollbar-arrow-color: #FFFFFF; } 10 | 11 | 12 | a:link { 13 | color: #3333CC; 14 | text-decoration: none; 15 | border: 0; 16 | } 17 | 18 | a:visited { color: #3333CC; text-decoration: none } 19 | 20 | a:active { color: #3333CC; text-decoration: none } 21 | 22 | a:hover { 23 | color: #990000; 24 | text-decoration: none; 25 | } 26 | TD { FONT: 12px arial, verdana, sans-serif;} 27 | 28 | .copyright { COLOR: #000000; FONT: 9px geneva, verdana, arial, sans-serif } 29 | 30 | .smalltitle { COLOR: #000000; FONT: 11px verdana, arial, sans-serif; font-weight: bold } 31 | .header { 32 | text-align: left; 33 | font-size: medium; 34 | font-family: Arial, Helvetica, sans-serif; 35 | font-weight: bold; 36 | } 37 | .top_area { 38 | font-family: Arial; 39 | font-size: medium; 40 | text-align: right; 41 | background-image: url('top_area.png'); 42 | vertical-align: bottom; 43 | } 44 | .mid_area { 45 | background-image: url('mid_area.png'); 46 | } 47 | .bottom_area { 48 | background-image: url('bottom_area.png'); 49 | } 50 | .header_table { 51 | 52 | text-align: left; 53 | font-size: small; 54 | font-family: Arial, Helvetica, sans-serif; 55 | font-weight: bold; 56 | } 57 | .medtitle { 58 | COLOR: #000000; 59 | FONT: bold 12px verdana, arial, sans-serif 60 | } 61 | .box { 62 | border: thin solid #000000; 63 | vertical-align: top; 64 | } 65 | -------------------------------------------------------------------------------- /doc_scenes/template/images/mid_area.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WhaleCodeObi/blender/7fff54584623371053d860468a35c713b94ec3dd/doc_scenes/template/images/mid_area.png -------------------------------------------------------------------------------- /doc_scenes/template/images/top_area.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WhaleCodeObi/blender/7fff54584623371053d860468a35c713b94ec3dd/doc_scenes/template/images/top_area.png -------------------------------------------------------------------------------- /doc_scenes/template/images/whitenoise.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WhaleCodeObi/blender/7fff54584623371053d860468a35c713b94ec3dd/doc_scenes/template/images/whitenoise.png --------------------------------------------------------------------------------