Getting error in project based on panda3d

Actually I am working on a project where I have to convert 2D floorplan images to 3D model.
I’m trying to run the code from following github FloorplanTransformation/rendering at main · jackyjaiswal123/FloorplanTransformation · GitHub
In this in order to convert into 3d model I have to run rendering/viewer.py file. But I’m getting error again and again. I solved few errors but since I’m not used to with panda3d, unable to rectify those errors. Since in this code they have used old version of panda3d (the version used to be in 2017) and python2.7 therefore on Anaconda prompt I setup newenv of python 2.7 and installed panda3d version 1.9.4 . Please help me out as I have to submit this project in 10-15 days

I would guess that “self.floorMat”, the “ObjMaterial” object, is attempting to load a given image-file and failing. As a result, it’s returning “None” when asked for its “egg-texture”, and “EggPrimitive”'s “set_texture” method doesn’t accept “None” as a parameter.

I’d suggest checking that your image-file is in the intended location (whatever that may be), that the path to that image-file is correct, and that the image-file is valid.

One potential start to this might be to place a breakpoint at line 34 of “floorplan.py” (or add some print-statements if you don’t have an IDE that supports breakpoints) and examine the state of “self.floorMat” and the image-path being used as “self.floorMat” attempts to load that image-path.

@Thaumaturge I checked the path of the image as mentioned in floorplan.py file. And I tried to print some statement in floorplan.py file where the images get loaded, it prints the statement in the output perfectly and got the same error. As I told u I’m not fully aware with the logic of the code so I can’t directly modify the code. I guess either the file which we are loading is not correct or there is some issue with the stateement “poly.setTexture(self.floorMat.getEggTexture())”. @Thaumaturge I tried to run the other function first in the file floorplan.py but wherever poly.setTexture(self.floorMat.getEggTexture()) is used it throws the same error. In line 34 of floorplan.py file the ObjMaterial() function is from obj2egg.py file, so it might possible we need to change something over there. Please help me out to sort this issue.

While it’s possible that the issue is with obj2egg, I have my doubts.

But did you try to print the file-path that’s being used, and did that file-path correspond correctly to the path to the file in your system?

Another possibility, it occurs to me, is that some other change that you’ve made has caused the problem, of course–in particular if you made changes related to “self.floorMat”.

@Thaumaturge I tried to print the current directory path which is being used, its exactly same as path which is used for the image loaded.
And I didn’t change anything in the code from the start.


@Thaumaturge

@Thaumaturge please suggest what changes should I do to clear this error, U can check even the images are proper the why its accepting none

Bro , I changed the obj2egg file and without error I received the output

@Thaumaturge there is one more problem, one more file we needed to run in this project . that is renderer.py file and getting error in that please look once

I’m afraid that I don’t use NumPy myself, so I’m not familiar with it.

That said, the error seems to indicate that you’re using a float-value where NumPy expects an int-value. Looking at the code and making some educated guesses, I would suspect that your “width” and/or “height” values are floats, and that NumPy is attempting to use the values that you’re passing in from them as indices or some such, which should be ints.

If I’m right, then converting your “width” and/or “height” values to ints–in whatever way makes most sense in the context of your program–when passing them into “np.ones” is likely to solve the problem.

[edit] Oh, and I’m glad that you solved the previous problem! :slight_smile:

Bro, I convert the self.width and self.height into int and the error disapper but the issue is the exexcution completely stooped over there for long time, after printing LVeCBase2f(1,1), it neither shows error nor completed the execution. one more thing I did in floorplan.py file at line 988,989,990,991 I commented those print statement, ig it’s not affecting that cause. could u help me why the execution is not ending. Actually this problem was occuring even when we were getting those Typeerror: the exection not ended .Always I have to close that anconda prompt and run it again

Which line is printing that vector?

Otherwise, it’s perhaps a good idea to use a debugger to determine at what line the execution is getting stuck. (If you’re not familiar with the use of a debugger with Python, there might be tutorials around the internet that describe how to go about it.)

@Thaumaturge while running viewer.py file I’m getting one error please check this out what is the issue


Actually now I’m trying with different another floorplan.txt file. with previous floorplan.txt file I didn’t receive any this kind of error

In short, it seems to indicate the the NodePath stored in the variable named “ceiling” is invalid (“empty”). Look into how that NodePath is being made, or whether something might be removing it, perhaps.

but where I can find that Nodepath.I ?

I would suggest not worrying about NodePath.i–it’s an internal engine file, likely the one that implements the “hide” method.

In short, it’s “hide” that’s crashing, but it’s crashing because it’s being given invalid data. The invalid data is likely the problem. (Either that or a lack of error-checking around the call to “hide”.)

More generally, “!is_empty()” errors are reasonably common things, and often indicate, well, much as I said above: that the method is being given an invalid NodePath, and that there’s likely a problem related to that NodePath or how it’s being handled.

Bro, sorry for this but I didn’t get what change should I do, because I couldn’t find where celieng.show()/hide() is being imeplemented ?

And with previous floorplan.txt file this is working very well

As I said, the implementation of “show”/“hide” is likely not relevant to the error; the error is related to the NodePath from which it’s being called.

Specifically, somehow “ceiling” is ending up “empty”. This can be due to it being removed at some point (such as by “removeNode” being called on it, or on one of its parents), or the NodePath being returned by certain methods that return an “empty” NodePath as an indication that they failed.

So, the thing to do is to find out how you’re ending up with an “empty” NodePath.