Is there a way to batch convert Collada dae files to Scenekit scn files?
My project uses approx 50 models created in sketchup that are updated regularly, these are exported to DAE but also need to be converted to SCN files for usage in xCode. I know it can be done manually via xCode and "Convert to SceneKit scene file format (scn)" but this take to much manual labour.
Based on https://the-nerd.be/2014/11/07/dynamically-load-collada-files-in-scenekit-at-runtime/ I figured out that the scntool is able to convert it via the command line and write the following script:
find ./dae -name "*.dae" | while read f ; do
inputfilename=$(basename $f)
echo $inputfilename
./scntool --convert $f --format scn --output ./scn/$inputfilename
done
for file in ./scn/*.dae; do
mv "$file" "./scn/$(basename "$file" .dae).scn"
done
#HixField has a good shell script for invoking scntool. Another way to do that is to leverage Xcode's build system, which does the same thing for any .dae files you put in a project's scnassets folder. Even if you're not bundling those files in your app, you can create a dummy Xcode target or project that contains all the assets you want to convert, and it'll convert them all whenever you build the target. (Which you could then integrate into a CI system or other automation.)
I agree with #Hixfield About everything except you need to add one more option to the scntool to get your materials correctly without need to re add all manually
scntool --convert INPUT.dae --format scn --output OUT.scn --asset-catalog-path .
The dot at the end of the command line is very important it means you will set resources to same location
If you don’t set the —asset-catalog-path . You will have no materials
Related
I have downloaded a medical data set to use in machine learning and the files are like this:
dicom_v1.tar.gz.aa
dicom_v1.tar.gz.ab
dicom_v1.tar.gz.ac
dicom_v1.tar.gz.ad
I don't know how to extract these files. When I use WinRAR or 7-Zip, it doesn't work.
It is written in the attached ReadMe file:
To decompress this data set execute in a Unix command line:
cat dicom_archive.tar.* | tar -xzvf
How can I do this in Windows 10 as I am a beginner?
These files have been split into chunks for distribution, so you need to put them back together before you can see whether Winrar or 7-zip will be able to extract them.
Since you're using Windows, you probably want to the Powershell get-content command (which helpfully aliased to cat btw) - and since the files are chunks of a compressed archive you probably want to use the -raw argument too.
https://shellgeek.com/use-cat-equivalent-type-command-in-windows/ is a good page to read.
I would try something like this as a starting point:
PS C:\> get-content -raw dicom_v1.tar.gz.* > dicom_v1.tar.gz
According to https://pureinfotech.com/extract-tar-gz-files-windows-10/ you should be able to run tar with the z flag natively in Powershell to extract all the files from the dicom archive.
LS,
At first i'm new to programming.
My study project is to mount an image (e01) to a free driveletter and copy out some registry files and ntuser.dat files.
The image files are on a server \foldername\number\number\name.E01
I have a working (small) script that mounts an image with only single partition. So finding the registerhives wasn't that hard.
Now i want to mount an image with more than one partition so it isn't clear that the partition i need to search for the registry hives is on the first mounted free drive letter.
If there are 3 partitions than there would be 3 driveletters that will be show in explorer.
So i have to determine which drives are already in use before mounting and after mounting which driveletters are added so i can search at those locations. i think compare something and than use the first free driveletter. That driveletter should be added to:
osfmount -a -t file -f \\servername\number\number\name.E01 -m #:
where the "#" is the driveletter. i don't know if i can alter the command so that it accept that # is a value that is pulled from another line. or something like that. don't know how to explain this.
it has to be in a batch file. so no python or any other scripting language
a co-worker pointed this to me:
pattern="foo"
for _dir in *"${pattern}"*; do
[ -d "${_dir}" ] && dir="${_dir}" && break
done
echo "${dir}"
yah, right....
maybe someone can put me in the right direction that i understand.
i will certainly type more code/lines than is necessary but hey, i'm a newbie.
tnx.
I am trying to use a MEL script to load ANIMATION.MA file that references CHARACTER_RIG.MA. The CHARACTER_RIG.MA and ANIMATION.MA files are produced by someone else and supplied to me. The ANIMATION.MA is looking for N:/Project/Maya//char/character/CHARACTER_RIG.MA
If I open ANIMATION.MA from Maya, or use the equivalent MEL command I always get prompted with:
"Reference File Not Found"
Reference File Not Found: N:/Project/Maya//char/character/CHARACTER_RIG.MA.
[Abort File Read] [Skip] [Browse...] [Retry]
If I tap browse, and select the CHARACTER_RIG.MA then it opens perfectly. I can see it created a reference in the Reference Editor that has the Unresolved Path (N:/...) , the Resolved Path (/my/path) and the namespace and the namespaceRN.
My question is, how do I do the equivalent of the "Browse..." from MEL? I tried pre-creating a reference, but it doesn't let me set the unresolved path, so when I load the ANIMATION.MA it keeps prompting in MAYA.
file -f -options "v=0" -typ "mayaAscii" -o "/Source/project/assets/anims/ANIMATION.MA"
If you know the directory where the file is, then you can use the dirmap command. The command dirmap allows you to remap directory structures if your disk configuration changes. So in this case it would look like:
dirmap -en true;
dirmap -m "N:/Project/Maya//char/character" "/my/path";
Possibly more manageable if you have lots of mappings to do especially when moving form a windows machine to a *nix one. However it is much more useful to define your project structure because then things just work when you move, tough this may not be the best of choice for shared assets.
I ended up finding several solutions:
Rename the RIG.MA file to match the filename in ANIM.MA (they were different in my case) and put it in one of the search or project folders that MAYA uses and it will automatically find it.
or
Programatically through code (or manually) edit the ANIM.MA file to remap the file/folder of the RIG.MA to where you want to load it from. Note: You
also need to remap any other files, such as textures. I did this with
perl -pi -e 's/\Qold-path\E/\Qnew-path\E/g' ANIMATION.MA
HTH someone else.
Quick and easy, File, Project, Set and select the folder where meshes or whatever it is.
I am looking for a way to convert several skp, kmz or dae files at once into 3ds or fbx format. In sketchup pro you can do export as...3ds or fbx but that would take too long to open each file and export it. Is there a command line in sketchup, or a script that could be used to perhaps automate this process?
Thanks
you need to invoke sketchup from the command-line specifying a script
to run immediately
sketchup.exe -RubyStartup d:\scripts\runexport.rb
in your ruby script (runexport.rb) you can
load your model. See http://code.google.com/apis/sketchup/docs/ourdoc/model.html#import
export your model. See http://code.google.com/apis/sketchup/docs/ourdoc/model.html#export
and finally, shutdown sketchup. See http://forums.sketchucation.com/viewtopic.php?f=180&t=29162
For recursively walking the directory, try this ruby code (from wikipedia)
Pattern matching using regular expressions
#define a recursive function that will traverse the directory tree
def printAndDescend(pattern)
#we keep track of the directories, to be used in the second, recursive part of this function
directories=[]
Dir['*'].sort.each do |name|
if File.file?(name) and name[pattern]
puts(File.expand_path(name))
elsif File.directory?(name)
directories << name
end
end
directories.each do |name|
#don't descend into . or .. on linux
Dir.chdir(name){printAndDescend(pattern)} if !Dir.pwd[File.expand_path(name)]
end
end
#print all ruby files
printAndDescend(/.+\.rb$/)
Is there a Notepad++ plugin out there that automatically combines all currently opened files into a single file?
Update: Yes, I am very aware of copy and paste :) I'm working with lots of files, and I want a solution that makes this step in the process a little bit faster than several dozen copy and pastes.
I'm aware of utilities for combining files, but I want the convenience of combining specifically the files that are currently opened in my text editor.
If there isn't a plugin out there already, I'll write one myself; I was just wondering if it exists already to save me the time of developing one.
I used the following command in DOS prompt to do the merge for me:
for %f in (*.txt) do type "%f" >> output.txt
It is fast and it works. Just ensure that all the files to be merge are in the same directory from where you execute this command.
http://www.scout-soft.com/combine/
Not my app, but this plug in lets you combine all open tabs into one file.
I installed the Python Script plugin and wrote a simple script:
console.show()
console.clear()
files = notepad.getFiles()
notepad.new()
newfile = notepad.getCurrentFilename()
for i in range(len(files) - 1):
console.write("Copying text from %s\n" % files[i][0])
notepad.activateFile(files[i][0])
text = editor.getText()
notepad.activateFile(newfile)
editor.appendText(text)
editor.appendText("\n")
console.write("Combine Files operation complete.")
It looks at all the files currently opened in Notepad++ and adds them to a new file. Does exactly what I need.