Archive stp dxf.sh
From ElphelWiki
Revision as of 20:58, 11 November 2011 by Andrey.filippov (talk | contribs) (Created page with "We use the following script to prepare mechanical CAD files for our wiki. Here is an example of the uploaded file set: [[Elphel_camera_parts_0353-19#0353-19-66_-_Pano_head_extern...")
We use the following script to prepare mechanical CAD files for our wiki. Here is an example of the uploaded file set: Pano head external body top/bottom.
Archived source: Media:archive_stp_dxf.sh.tar.gz
#!/bin/sh #** #** -----------------------------------------------------------------------------** #** archive_stp_dxf.sh #** Preparing Varicad output files output for uploadig to wiki.elphel.com: #** 1 - adding license information to *.stp files output #** 2 - compressing *.dwb, *.dxf and *.stp files #** 3 - cropping and converting *.bmp renderings to JPEG #** #** Copyright (C) 2010-2011 Elphel, Inc. #** #** -----------------------------------------------------------------------------** #** #** focus_tuning.java is free software: you can redistribute it and/or modify #** it under the terms of the GNU General Public License as published by #** the Free Software Foundation, either version 3 of the License, or #** (at your option) any later version. #** #** This program is distributed in the hope that it will be useful, #** but WITHOUT ANY WARRANTY; without even the implied warranty of #** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #** GNU General Public License for more details. #** #** You should have received a copy of the GNU General Public License #** along with this program. If not, see <http://www.gnu.org/licenses/>. #** -----------------------------------------------------------------------------** #Replacing description and organization tags in STEP 3D files. #Varicad outputs them as: #... #FILE_DESCRIPTION( #/* description */ ('VariCAD 2010-3.03 AP-214'), #/* implementation_level */ '2;1'); # #FILE_NAME( #/* name */ '0353-22-10-test-load-saved', #/* time_stamp */ '2011-10-13T17:21:56-06:00', #/* author */ (''), #/* organization */ (''), if [ -n "$1" ]; then DESCRIPTION="(C) Elphel, Inc. 2011. Licensed under CERN OHL v.1.1 or later, see http://ohwr.org/cernohl"; ORGANIZATION="Elphel, Inc"; echo "Adding >$DESCRIPTION< and >$ORGANIZATION< to >$1<" mv $1 $1.original cat $1.original | sed -e "s#\* description \*/ [(]'[^']*'[)]#* description */ ('$DESCRIPTION')#g" | sed -e "s#\* organization \*/ [(]'[^']*'[)]#* organization */ ('$ORGANIZATION')#g" > $1 tar -czvf $1.tar.gz $1 mv $1.original $1 else find . -maxdepth 1 -iname '*.stp' -exec $0 '{}' \; find . -maxdepth 1 -iname '*.dxf' -exec tar '-czvf' '{}'.tar.gz '{}' \; find . -maxdepth 1 -iname '*.dwb' -exec tar '-czvf' '{}'.tar.gz '{}' \; mogrify -trim -format jpeg *.bmp fi