We are attempting to update the texture on a node. The code below works correctly when we use a color, but it encounters issues when we attempt to use an image. The image is available in the bundle, and it image correctly in other parts of our application. This texture is being applied to both the floor and the wall. Please assist us with this issue."
for obj in Floor_grp[0].childNodes {
let node = obj.flattenedClone()
node.transform = obj.transform
let imageMaterial = SCNMaterial()
node.geometry?.materials = [imageMaterial]
node.geometry?.firstMaterial?.diffuse.contents = UIColor.brown
obj.removeFromParentNode()
Floor_grp[0].addChildNode(node)
}
RoomPlan
RSS for tagCreate parametric 3D scans of rooms and room-defining objects.
Posts under RoomPlan tag
90 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
We are using the RoomPlan API to capture data, which is stored in the 'CapturedRoom' variable in our code (referred to as 'finalResult'). We then attempt to save a USDZ file in the file manager. Sometimes it works, but other times, we encounter issues like the one below
Coding Error: in _IsValidPathForCreatingPrim at line 3338 of usd/stage.cpp -- Path must be an absolute path: <>
cannotCreateNode(path: "/9EE71ED0F8D6415496A7B9F0C3671DB0321")
This is that code we are using for shaving CapturedRoom data
func saveFileLocal() {
if let finalResult {
let fm = FileManager.default
let documentsURL = fm.urls(for: .documentDirectory, in: .userDomainMask).first!
//let documentsURL = URL.documentsDirectory
let fileName = "\(UUID().uuidString).usdz"
let fileURL = documentsURL.appendingPathComponent(fileName)
do {
try finalResult.export(to: fileURL)
} catch {
print(error)
}
}
}
Please help us.
I'm just curious if anybody knows if under the hood RoomPlan is applying any sort of sorting to the CapturedRoom.walls array. Like does RoomPlan try to sort the walls so they complete a loop? Or are walls simply appended to the back of the array as they are detected?
We are trying to save usdz file in file manager some time its saved but some time we are getting the error. Like: path.absoluteURL file:///var/mobile/Containers/Data/Application/6D14A430-47B4-45F2-9D0D-6C31588A6A03/Documents/2896837C-C7E0-4FA8-BFE2-21A59B26D801.usdz Warning: in SdfPath at line 151 of sdf/path.cpp -- Ill-formed SdfPath </2896837CC7E04FA8BFE221A59B26D801>: syntax error Coding Error: in _IsValidPathForCreatingPrim at line 3338 of usd/stage.cpp -- Path must be an absolute path: <> cannotCreateNode(path: "/2896837CC7E04FA8BFE221A59B26D801")
func saveFileLocal() {
if let finalResult {
let fm = FileManager.default
var path = fm.urls(for: .documentDirectory, in: .userDomainMask).first!
let fileName = "(UUID().uuidString).usdz"
path.appendPathComponent(fileName)
do {
try finalResult.export(to: path.absoluteURL)
}
catch{
print(error)
}
}
}
func removeFiles() {
var filePath = ""
let fm = FileManager.default
let path = fm.urls(for: .documentDirectory, in: .userDomainMask).first!
do{
let content = try fm.contentsOfDirectory(atPath: path.path)
for c in content{
filePath = path.appendingPathComponent(c).absoluteString
if let url = URL(string: filePath){
try fm.removeItem(at: url)
}
}
}
catch{
print(error)
}
}
I am using the RoomPlanExampleApp to export a USDZ. When I open the USDZ on Reality Converter, I get this error
Invalid Structure in USDZ file
The root layer of the package must be a usdc file and must not include any external dependencies that participate in stage composition.
Is there a way to combine roomplan api with arkit+metalkit to get both pointcloud .ply output and roomplan 3d room model .usdz?
We want to be able to use our own prompt / coaching for RoomPlan
I see that I can override the following method to see the RoomCaptureSession.Instruction and then add or our UI to coach the customer
func captureSession(_ session: RoomCaptureSession, didProvide instruction: RoomCaptureSession.Instruction) {
Logger.log(.info, category: .roomplan, message: "RoomCaptureSession.Instruction(\(instruction))")
// Show coaching prompts
}
However, I don't know how to remove the coaching UI provided by the OS.
If I disable coaching
sessionConfig = RoomCaptureSession.Configuration()
sessionConfig.isCoachingEnabled = false
Then the callback above was not being called.
I really want a willProvide method that I can return 'false' to say that I want to give my own UI instead of the UI provided by RoomPlan.
Is there a way to provide my own ui for these RoomCaptureSession.Instructions?
Thanks in advance
I need to generate a thumbnail from CapturedRoom, that is either a static frame of the PIP thumbnail that we see in the result after scanning. Ideally an image, but I could also use a simplified OBJ if that's a possibility. From documentation it looks like the only option is to export as USDZ. Is there a way to generate a static image file after room scan is processed?
try finalResults?.export(to: destinationURL, exportOptions: .mesh)
I'm unable to debug on iPhone 12 running iOS 17 beta 3 via network. I'm running Xcode 15 beta 6
Device shows in devices and simulators and I can debug when connected with cable.
However the "Connect Via Network" option is frayed out, oddly however the checkbox is ticked
I'm developing a app using RoomPlan so network connectivity is a must for debugging
Anyone else encountered this and know how to get around this problem
Other devices running iOS 16 connect via network just fine
I have got a crash related with RoomPlan framework on iOs 13.5.1
Hardware Model: iPad6,11
Process: xxxxxxx [4677]
Path: /private/var/containers/Bundle/Application/15CC2737-2FFD-4A17-A111-A2DB7A6838E0/xxxxxxx.app/xxxxxxx
Identifier: xxxxxxx
Version: 1489 (4.7.3)
AppStoreTools: 14E221
AppVariant: 1:iPad6,11:13
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Coalition: xxxxxxx [1071]
Date/Time: 2023-08-05 04:34:53.0188 +0700
Launch Time: 2023-08-05 04:34:52.7050 +0700
OS Version: iPhone OS 13.5.1 (17F80)
Release Type: User
Baseband Version: n/a
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Description: DYLD, can't resolve symbol _$s8RoomPlan0A14CaptureSessionC13ConfigurationVMa in /private/var/containers/Bundle/Application/15CC2737-2FFD-4A17-A111-A2DB7A6838E0/xxxxxxx.app/xxxxxxx because dependent dylib #40 could not be loaded
Triggered by Thread: 0
Thread 0 name:
Thread 0 Crashed:
0 dyld 0x0000000105ea8f68 __abort_with_payload + 8
1 dyld 0x0000000105eafee8 abort_with_payload_wrapper_internal + 100 (terminate_with_reason.c:102)
2 dyld 0x0000000105eaff18 abort_with_payload + 12 (terminate_with_reason.c:124)
3 dyld 0x0000000105ead13c dyld::halt(char const*) + 384 (dyld2.cpp:4240)
4 dyld 0x0000000105e607fc dyld::fastBindLazySymbol(ImageLoader**, unsigned long) + 168 (dyld2.cpp:4328)
5 libdyld.dylib 0x00000001b1482398 dyld_stub_binder + 60
6 xxxxxxx 0x000000010475cc38 type metadata completion function for RoomPlanCaptureViewController + 60 (<compiler-generated>:0)
7 libswiftCore.dylib 0x00000001bedcf76c swift_getSingletonMetadata + 956 (MetadataCache.h:920)
8 xxxxxxx 0x000000010475a540 type metadata accessor for RoomPlanCaptureViewController + 48 (<compiler-generated>:0)
9 libobjc.A.dylib 0x00000001b13ab958 realizeAllClasses() + 112 (objc-runtime-new.mm:2840)
10 libobjc.A.dylib 0x00000001b13ae6dc objc_getClassList + 92 (objc-runtime-new.mm:5013)
.
.
14 dyld 0x0000000105e732c4 ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) + 428 (ImageLoaderMachO.cpp:2427)
15 dyld 0x0000000105e736b0 ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) + 52 (ImageLoaderMachO.cpp:2524)
16 dyld 0x0000000105e6e0f0 ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) + 536 (ImageLoader.cpp:1621)
17 dyld 0x0000000105e6c520 ImageLoader::processInitializers(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) + 184 (ImageLoader.cpp:605)
18 dyld 0x0000000105e6c5e8 ImageLoader::runInitializers(ImageLoader::LinkContext const&, ImageLoader::InitializerTimingList&) + 92 (ImageLoader.cpp:620)
19 dyld 0x0000000105e61a64 dyld::runInitializers(ImageLoader*) + 88 (dyld2.cpp:4923)
20 dyld 0x0000000105e687b8 dlopen_internal + 832 (dyldAPIs.cpp:1761)
21 libdyld.dylib 0x00000001b1483a08 dlopen + 172 (dyldAPIsInLibSystem.cpp:1545)
.
.
.
30 dyld 0x0000000105e732c4 ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) + 428 (ImageLoaderMachO.cpp:2427)
31 dyld 0x0000000105e736b0 ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) + 52 (ImageLoaderMachO.cpp:2524)
32 dyld 0x0000000105e6e0f0 ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) + 536 (ImageLoader.cpp:1621)
.
.
36 dyld 0x0000000105e687b8 dlopen_internal + 832 (dyldAPIs.cpp:1761)
37 libdyld.dylib 0x00000001b1483a08 dlopen + 172 (dyldAPIsInLibSystem.cpp:1545)
38 substitute-inserter.dylib 0x0000000106019284 0x105f3c000 + 905860
39 substitute-inserter.dylib 0x0000000106326ac0 0x105f3c000 + 4106944
40 substitute-inserter.dylib 0x00000001062e7980 0x105f3c000 + 3848576
41 dyld 0x0000000105e732c4 ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) + 428 (ImageLoaderMachO.cpp:2427)
42 dyld 0x0000000105e736b0 ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) + 52 (ImageLoaderMachO.cpp:2524)
43 dyld 0x0000000105e6e0f0 ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, char const*, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) + 536 (ImageLoader.cpp:1621)
44 dyld 0x0000000105e6c520 ImageLoader::processInitializers(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) + 184 (ImageLoader.cpp:605)
45 dyld 0x0000000105e6c5e8 ImageLoader::runInitializers(ImageLoader::LinkContext const&, ImageLoader::InitializerTimingList&) + 92 (ImageLoader.cpp:620)
46 dyld 0x0000000105e5e608 dyld::initializeMainExecutable() + 136 (dyld2.cpp:1569)
47 dyld 0x0000000105e62eb0 dyld::_main(macho_header const*, unsigned long, int, char const**, char const**, char const**, unsigned long*) + 4400 (dyld2.cpp:6989)
48 dyld 0x0000000105e5d208 dyldbootstrap::start(dyld3::MachOLoaded const*, int, char const**, dyld3::MachOLoaded const*, unsigned long*) + 396 (dyldInitialization.cpp:145)
49 dyld 0x0000000105e5d038 _dyld_start + 56
by framework is weakly linked
Load command 53
cmd LC_LOAD_WEAK_DYLIB
cmdsize 80
name /System/Library/Frameworks/RoomPlan.framework/RoomPlan (offset 24)
time stamp 2 Thu Jan 1 03:00:02 1970
current version 1.0.0
compatibility version 1.0.0
I'm trying to merge room with WorldMap:
but my screen goes black when doing a scan,
First: i load world map
arWorldTrackingConfig.initialWorldMap = worldMap
//arWorldTrackingConfig.planeDetection = [.horizontal, .vertical]
arSession.run(arWorldTrackingConfig)
if #available(iOS 17.0, *) {
roomCaptureView = RoomCaptureView(frame: view.bounds, arSession: arSession)
}
else{
roomCaptureView = RoomCaptureView(frame: view.bounds)
}
roomCaptureView = RoomCaptureView(frame: view.bounds)
roomCaptureView.captureSession.delegate = self
roomCaptureView.delegate = self
view.insertSubview(roomCaptureView, at: 0)
and save when scan done:
roomCaptureView?.captureSession.arSession.getCurrentWorldMap { worldMapData, error in
if let error = error {
return
}
if let worldMap = worldMapData {
let fileURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0].appendingPathComponent("worldMapData")
do {
let data = try NSKeyedArchiver.archivedData(withRootObject: worldMap, requiringSecureCoding: true)
try data.write(to: fileURL)
} catch {
print("error ARWorldMap: \(error.localizedDescription)")
}
}
}
the first scan is fine, but the next time, when the worldMap is saved and loaded, my screen goes black,
does anyone have a solution or sample code??
-thank-
I am trying to find the size limitations for RoomPlan. Originally I was planning to get this data from the exceedSceneSizeLimit error. But it appears that errors are only given to the delegate once the captureSession is ended and it provides the final capture data to the delegate.
Is there a method to extract the iphone position and orientation? Or to get the trajectory of the iphone during the room scan?
Hi,
I'm trying to implement the RoomPlan, could you tell me pls, which methods I can use to manipulate with resulted rendered room model: i.e. chenge the wall color by click etc. It can looks laughly but I didn't use this API before. If it doesnt have such functions please recoomend the api which I can use to manipulte scan results for such case: selecting a wall and change its color or marking it with some symbols which should be rendered on it. Thx
Is there an easy way from API to get surface area measurements?
I am building an app that uses the RoomPlan API, but I am hoping to change the UI, is it possible to, for instance, change the color of the lines that are displayed? Also, there only appears to be a way to turn off the live model, not translate it around the screen. Is it possible to do either of these things in IOS 17's RoomPlan?
Hey team, I was looking at the new Sections data in RoomPlan. It's really awesome! However, it looks like the polygons data is being stored as a SIMD2 instead of SIMD3. Is the data being cast incorrectly? (I see the Y axis seems to match the ground level). If so, would you mind fixing this bug? It would be great to see this data!
Hello fellow developers,
When attempting to merge single rooms into one model, the resulting floorplan I got appears to have rooms stacked on top of each other.
I am using a single ARSession for all the scans, to my understanding, the world coordinate system remains consistent during a continuous ARSession. I can't figure out why the rooms are overlapping or positioned vertically on top of each other in the generated floorplan. I am uncertain whether this issue stems from my own code implementation.
I did the following modification to the sample code
Initiated an ARSession in RoomCaptureViewController
private var arWorldTrackingConfig: ARWorldTrackingConfiguration = ARWorldTrackingConfiguration()
private var arSession: ARSession = ARSession()
Pass ARSession to roomCaptureView
private func setupRoomCaptureView() {
arSession.run(arWorldTrackingConfig)
roomCaptureView = RoomCaptureView(frame: view.bounds, arSession: arSession)
roomCaptureView.captureSession.delegate = self
roomCaptureView.delegate = self
view.insertSubview(roomCaptureView, at: 0)
}
Pause the ARSession after completion of scanning one room
private func saveSession() {
isScanning = false
roomCaptureView?.captureSession.stop(pauseARSession: false)
setCompleteNavBar()
}
@IBAction func saveScanning(_ sender: UIBarButtonItem) {
if isScanning { saveSession() } else { cancelScanning(sender) }
self.exportButton?.isEnabled = false
self.activityIndicator?.startAnimating()
}
Any experiences or insights are greatly appreciated.