How to Convert .USDz formats to .OBJ or .ABC files? - swift

I have been trying to build a solution to converting from .USDZ to other [3D formats].
Using online options you may convert [3D formats] to .USDz using:
https://www.vectary.com/3d-modeling-how-to/how-to-create-usdz-file-for-ar-online/
or
https://www.vectary.com/3d-modeling-news/usdz-converter-create-usdz-files-for-free-online-with-vectary/
Using Houdini plugins was not successful I was only able to import not export .USDz.
This basic command line converts from OBJ files, Single-frame Alembic (ABC) files, USD file (either .usda or usd.c) to .USDz.
xcrun usdz_converter myFile.obj myFile.usdz
Will this command convert the other way.
I have also found that this command line will convert [.OBJ, .ABC] to .USDz but don't know if it will convert the other way:
usdcat --flatten -o myFIle.abc myFile.usd

If you have macOS + Xcode you can open .usdz file in the default viewer and export it to .obj file.
With your mydocument.usdz file open, select File -> Export and then select "Geometry Definition File Format"

Related

importing a module in Swift

I'm kicking the tires of Swift a little. I'm not using Xcode. I just have a simple .swift file and #!/usr/bin/env swift at the top of the file.
In the file, I have import Blahblah and a file called Blahblah in the same directory.
I get error: no such module 'Blahblah' however when running the .swift file.
How do I import the swift module? Is there something special I need to do?

Importing other libraries when using Swift as a scripting language

Heyo. I'm using Swift to make a simple web crawler for fun and practice. I made an Project.swift file and added it to a folder on my desktop. I now want to add SwiftyJSON to my project. I tried putting SwiftyJSON.swift in the same folder and adding import SwiftyJSON on top, but this did nothing. No import statement does not work at all. Is there any way to do this except pasting the whole file to the bottom of my project.swift file, or should I just stick to Python?
You have to start from the file named main.swift - that's your application entry point:
// main.swift
import Foundation
let data = "{\"message\" : \"Hello World\"}".dataUsingEncoding(NSUTF8StringEncoding)
let myJson = JSON(data:data!)
print(myJson["message"])
So you don't have to use include, but you'll need to specify all external dependencies when compiling:
swiftc SwiftyJSON.swift main.swift
./main
If you're using XCode Command Line Tool template, main.swift will be created for you by default, and you'd be able add more .swift files to your project and just use them, no need to use import.

Modifiying an xcode strings file post Archive: Converting Binary to UTF-8

During the build and archive of my application the .strings files are copied into the application bundle, e.g.
CopyStringsFile
/Users/Systems/Library/Developer/Xcode/DerivedData/MyProject-dqtbpsfqkwnliuflrsytopqbuvpr/Build/Intermediates/ArchiveIntermediates/Evolve/InstallationBuildProductsLocation/Applications/Evolve.app/en.lproj/InfoPlist.strings
MyProject/en.lproj/InfoPlist.strings
cd /Users/Systems/luke/repos/MyProject/MyProject
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
builtin-copyStrings --validate --inputencoding utf-8 --outputencoding binary --outdir /Users/Systems/Library/Developer/Xcode/DerivedData/MyProject-dqtbpsfqkwnliuflrsytopqbuvpr/Build/Intermediates/ArchiveIntermediates/Evolve/InstallationBuildProductsLocation/Applications/Evolve.app/en.lproj
-- MyProject/en.lproj/InfoPlist.strings
Unzipping the ipa and loading the string file into a text editor shows the binary content.
I would like to use bash to read the content of the strings file in ASCII UTF-8, find and replace some strings and encode it into binary again.
Specifically, how should I decode the contents of the file into ASCI?
It turned out it was a super simple bash command:
plutil -convert xml1 <PATH_TO_STRINGS_FILE>
And to convert it back again:
plutil -convert binary1 <PATH_TO_STRINGS_FILE>

Compile iOS strings files from command line

Compiled iOS apps have localized strings files compiled into binary PList files and they are converted by Xcode.
Is there any way to compile them from command line from the original strings files?
I think I found what I was looking for:
plutil -convert binary1 Localizable.strings
plutil it is.
The build task is here /Developer/Library/Xcode/Plug-ins/CoreBuildTasks.xcplugin/Contents/Resources/CopyStringsFile.xcspec
It runs copystrings ruby script, which is based on iconv and plutil

Printing objects inside a lib file

What is the command to print .o files inside a .a file inside ?
man ar tells you the syntax is ar t name/of/lib as in ar t /usr/lib/libc.a