USDZ File Not Loading on iPhone 7 - xcode

Our USDZ file won't load on iPhone 7 with iOS 12. It works fine on my iPhone X and iPad Pro, both running iOS 12 Beta.
We've tried creating this using the terminal commands and get the following warning although we don't believe this is the issue.
Warning: in CreateMaterialBindings at line 59 of /BuildRoot/Library/Caches/com.apple.xbs/Sources/3DAssetTools/3DAssetTools-14207.2/external/ModelKit/extern/usd/pxr/usd/usdObj/translator.cpp -- OBJ mtl usemtl name has invalid name '15___Default', using default usemtl name: 'defaultShadeGroup0'
The screen on the iPhone 7 looks as such:
You can download the raw files here.

You can't see your 3D model because you're using very bad naming convention for file model2_$$usd_converter$$_.usdc inside usdz container. In macOS and iOS you have to avoid using $ in file names, because dollar sign is a special character.
Follow these two steps to unzip, rename and rezip your usdz file.
First Step (unzip mmtest.usdz file)
To unzip a usdz file in macOS Mojave use the following method:
In Finder change the extension of .usdz file to .zip.
Uncompress .zip file using Archive_Utility.app or RAR_Extractor.app.
Open unzipped directory and change files' names.
Make sure all textures are in JPG and/or PNG format.
Make sure 3D normals of your USDC model ain't inverted.
Second Step (recreate usdz again)
Make sure that Xcode 10.2 is installed.
To convert a content of unzipped folder (binary usdc file and its textures) to usdz file format again, use the following command in Terminal.app:
cd ~/Desktop/mmtest/
xcrun usdz_converter Model.usdc Model.usdz
-g SofaMesh
-color_map Diffuse.jpg
-roughness_map Roughness.png
-normal_map Normal.jpg
And here are a full list of options (type xcrun usdz_converter -h in Terminal):
-g groupName [groupNames ...] Apply subsequent material properties to the named group(s).
-m materialName [materialNames ...] Apply subsequent material properties to the named material(s).
-h Display help.
-a Generate a .usda intermediate file. Default is .usdc.
-l Leave the intermediate .usd file in the source folder.
-v Verbose output.
-f filePath Read commands from a file.
-texCoordSet set The name of the texturemap coordinate set to use if multiple exist (no quotes).
-opacity o Floating point value 0.0...1.0
-color_default r g b a Floating point values 0.0...1.0
-normal_default r g b a Floating point values 0.0...1.0
-emissive_default r g b a Floating point values 0.0...1.0
-metallic_default r g b a Floating point values 0.0...1.0
-roughness_default r g b a Floating point values 0.0...1.0
-ao_default r g b a Floating point values 0.0...1.0
-color_map filePath
-normal_map filePath
-emissive_map filePath
-metallic_map filePath
-roughness_map filePath
-ao_map filePath
Now model works perfectly.

Related

Bash - can't use command 'bc' since Bandizip have the command with same name

I trying to use Linux bc to do division between two float number, but it throw an error, and I realize when I run bc, it execute Bandizip command
$ bc
bc 6.08(Alpha) - Bandizip Command line tool. Copyright(C) 2011-2017 Bandisoft
Usage:
bc <command> [<switches>...] <archive> [<files>...] [<path_to_extract>]
<Commands>
a : Add files to archive
x : eXtract files with full pathname
t : Test integrity of archive
d : Delete files from archive
c : Create new archive(or overwrite exist file)
e : Extract files without directory names
<Switches>
- Stop switches scanning
-l:<0...9> Set compression level (0:store, 5:default, 9:maximal)
-r- Disable recursion (default)
-r Enable recurse subdirectories
-aoa Overwrite All existing files without prompt
-aos Skip extracting of existing files
-aou aUto rename extracting file
(for example, name.txt will be renamed to name (2).txt)
-sfx:[{name}] Create SFX archive
-zopfli Use Zopfli as deflate compressor(very slow)
-p:{password} Set password
-o:{dir} Specify target folder
-y Assume Yes on all queries
-fmt:{fmt} Specify archive format
(zip, zipx, exe, tar, tgz, lzh, iso, 7z, gz, xz)
-v:{size} Specify volume size(-v:1000000 -v:1440k -v:100MB ...)
-target:auto Extract to target path smartly
-target:name Extract to archive-name folder of target path
I can't uninstall bandizip and can't use other command to divide two float number since I already have lot function write by using bc
How to solve this problem?
First of all, the bc application have to exists in at least two different directories.
It seems to me like the PATH variable from your shell or system is configured wrong so it first finds the wrong bc application first.
You can print the PATH variable from your shell, for example:
# echo $PATH
/usr/gnu/bin:/usr/local/bin:/usr/ucb:/bin:/usr/bin
As you can see, there is a colon (:) separated list of paths which are searched when you type in a command (relatively).
This means, for the above path, your shell (e.g. bash) searches for your command in the following order, until it was found:
/usr/gnu/bin
/usr/local/bin
/usr/ucb
/bin
/usr/bin
If the command could not be found, you should see something like this:
# pacman
pacman: Command not found.
Due it is more obvious that bc is the calculator, you should ensure that the path which contains the calculator bc is listed before the other path in the PATH variable.
Very sure the person who installed Bandizip Command put the path in the global shell configuration, e.g. /etc/profile.

gnuplot under windows: how to specify window size/position when it startup?

Under windows 10, how can I specify window postion (X,Y) and window size (width,height) of gnuplot, via command line arguments?
The path of the application is
D:\gnuplot\bin\wgnuplot.exe
how can specify window postion and size with it? like with cygwin mintty:
D:\cygwin\bin\mintty.exe -i /Cygwin-Terminal.ico
-p 372,12 -s 135,50 -o Font=Consolas -o FontHeight=13 -
show version long output
Version 5.2 patchlevel 0 last modified 2017-09-01
Compile options:
+READLINE -LIBREADLINE +HISTORY
-BACKWARDS_COMPATIBILITY +UNICODE +OBJECTS +STATS +EXTERNAL_FUNCTIONS
+LIBCERF +GD_PNG +GD_JPEG +GD_TTF +GD_GIF +ANIMATION
-USE_CWDRC +USE_MOUSE +HIDDEN3D_QUADTREE
MAX_PARALLEL_AXES=13
P.S.
I mean the window of gnuplot, not the graph it plots.
Gnuplot under Windows 10 can use an init file wgnuplot.ini which is located at %AppData% (C:\Users\maij\AppData\Roaming in my case).
You can generate and update the file by clicking the upper left icon of the gnuplot window and following "Options -> Update wgnuplot.ini" (see the following picture). Please play a bit with window positions and sizes and updating the ini file to see how it works.
My suggestion would be to generate wgnuplot.ini with the appropriate entries before launching gnuplot.
Currently my wgnuplot.ini looks as follows:
[WGNUPLOT]
TextOrigin=290 50
TextSize=785 489
TextMinimized=0
TextMaximized=0
TextFont=Consolas,9
TextWrap=1
TextLines=400
SysColors=0
DockVerticalTextFrac=350
DockHorizontalTextFrac=400
TextOrigin and TextSize are the options you are interested in.

How to print filename/current directory as a title in octave plot from bash?

I am new to octave and need to plot a 2-D graph with customized title either as a file name or current directory name. I tried passing pwd in the plot.m file but it gives me a complete path instead of directory name only. Actually all I need is a customized title without manually hard coding the string inside xlabel('strings').
I don't have Octave but this works on MATLAB:
current_directory_name = pwd;
current_directory_split = regexp(current_directory_name,'/','split');
string_of_interest = current_directory_split(end);
xlabel(string_of_interest);
I am assuming you are on *NIX computer. For Windows computer, change / to \ in the split command.
If I understood your question correctly, you want a portable way of retrieving the file name w/o the directory name. Use fileparts():
[dir, name, ext, ver] = fileparts(pwd)
If you later decide to join strings, use filesep which is portable no matter if you're on Unix or not.

Accessing files within a parent folder and it's sub-folders using Python

I have a folder which has subfolders containing 1000s of DICOM images which I want to read in from IDLE and analyze.
I have used the following code to find file paths:
import sys
print sys.path
I subsequently tried placing my folder which I want to access in these file paths, however I still can not access the files and I get the following error:
>>> fp = open(fp, 'rb')
IOError: [Errno 2] No such file or directory: 'IM-0268-0001.dcm'
I have also tried:
sys.path.insert(0, 'C:/desktop/James_Phantom_CT_Dec_16th/Images')
But this did not work for me either. Help much appreciated, very frustrated.
(using Python 2.7, 64 bit windows OS).
When opening a file, Python does not search the path. You must specify the full path to open:
d = 'C:/desktop/James_Phantom_CT_Dec_16th/Images'
fp = open(d +'IM-0268-0001.dcm',"rb")
Edit: d is the string that will hold the path so that you don't have to re-type it for each file. fp will hold the file object that you will work with. The "rb" is the way you want to open the file:
r - read
w - write with truncate
a - append
r+ - read and write
Also, if working in windows, add "b" to work with binary files. See here.

Set icon of non app mac os x bundle

How to set icon for bundle which is not an app? I tried using CFBundleIconFile, but it doesn't work (though if I just change bundle extension to .app, icon is changed to desired one). Is there another key, or the only way is to set icon for directory? If so, is there already some script to do this from command line (Xcode run script)?
If you need to do it from CLI... It's a bit more involved...
First, you need to add a CFBundleIconFile string to your bundle's
YourThing.bundle/Contents/Info.plist
Here's where the developer gets to
specify a custom icon for the bundle.
This key contains the name of a file
in the bundle's Resources folder that
holds the icons. TextEdit keeps its
icon in a file called Edit.icns file,
but there's no rule about what the
name of the file must be.
That said, you either need an ICNS file, or can follow these instructions from this Utility (which includes its source code) that generates ICNS's from image files via the command line..
$ ./makeicns
Usage: makeicns [k1=v1] [k2=v2] ...
Keys and values include:
512: Name of input image for 512x512 variant of icon
256: Name of input image for 256x256 variant of icon
128: Name of input image for 128x128 variant of icon
32: Name of input image for 32x32 variant of icon
16: Name of input image for 16x16 variant of icon
in: Name of input image for all variants not having an explicit name
out: Name of output file, defaults to first nonempty input name,
but with icns extension
Examples:
makeicns -512 image.png -32 image.png
Creates image.icns with only a 512x512 and a 32x32 variant.
makeicns -in myfile.jpg -32 otherfile.png -out outfile.icns
Creates outfile.icns with sizes 512,
256, 128, and 16 containing data
from myfile.jpg and with size 32 containing data from otherfile.png.
Answer from similar (duplicate) question:
[[NSWorkspace sharedWorkspace]
setIcon:(NSImage *)image
forFile:(NSString *)bundlePath
options:0];

Resources