Git Product home page Git Product logo

Comments (8)

howetuft avatar howetuft commented on August 16, 2024

Hello,

Well, I'm not sure to see a problem in what you describe, but I may not fully understand your point.
Just to make things clear, I've written a small script you can copy/paste in the console:

import Render

doc = App.newDocument()

# Create a part
cube = doc.addObject("Part::Box","Box")
cube.Label = "Cube"

# Create a link
link = doc.addObject('App::Link','Link')
link.setLink(cube)
link.Label = "CubeLink"
link.Placement.translate(App.Vector(15, 0, 0))

doc.recompute()

# Place point of view
Gui.activeView().viewDefaultOrientation()
Gui.runCommand('Std_PerspectiveCamera', 1)

# Create a Render Project (select your own renderer)
proj, _, _ = Render.Project.create(doc, renderer="Ospray", template="ospray_studio_light.sg")
# proj, _, _ = Render.Project.create(doc, renderer="Povray", template="povray_studio_light.pov")
# proj, _, _ = Render.Project.create(doc, renderer="Cycles", template="cycles_studio_light.xml")

# Add views
proj.add_view(cube)
proj.add_view(link)

# Render
proj.render()

Do we agree that, with such a script, we expect to see 2 cubes in the rendering (the original and the link)?

from freecad-render.

berberic2 avatar berberic2 commented on August 16, 2024

There is not one „std part“ in your example at all, so this script does not produce the problem. Try this:

import Render

doc = App.newDocument()

# Create a std part
part = doc.addObject('App::Part','Part')
part.Label = "std part"
cube = doc.addObject("Part::Box","Box")
cube.Label = "Cube"
part.addObject(cube)

# Create a link
link = doc.addObject('App::Link','Link')
link.setLink(part)
link.Label = "std part link"
link.Placement.translate(App.Vector(15, 0, 0))

doc.recompute()

# Place point of view
Gui.activeView().viewDefaultOrientation()
Gui.runCommand('Std_PerspectiveCamera', 1)

# Create a Render Project (select your own renderer)
# proj, _, _ = Render.Project.create(doc, renderer="Ospray", template="ospray_studio_light.sg")
# proj, _, _ = Render.Project.create(doc, renderer="Povray", template="povray_studio_light.pov")
proj, _, _ = Render.Project.create(doc, renderer="Cycles", template="cycles_studio_light.xml")

# Add views
proj.add_view(part)
proj.add_view(link)

# Render
proj.render()

Edit:
Result looks like this:
Screenshot_20231103_172340

from freecad-render.

howetuft avatar howetuft commented on August 16, 2024

OK, thank you, this is clearer, I'm gonna investigate.

from freecad-render.

berberic2 avatar berberic2 commented on August 16, 2024

Fine.
To get the second problem, comment the proj.add_view(part) out. The part is rendered even it has not been added…

from freecad-render.

howetuft avatar howetuft commented on August 16, 2024

Yes, you're right. Actually, the 'std part link' object has got a Group property, pointing to the underlying Cube. In such case, it is not clear for me how to handle it precisely: create views for all components + container, or for container only (I've already encountered both cases...).
Seems that 'links to App::part' should follow the second behaviour (container only), whereas they are currently defaulted to first one. I'm gonna fix it...

from freecad-render.

howetuft avatar howetuft commented on August 16, 2024

Hello,
#322 should fix the problem, could you please confirm?

from freecad-render.

berberic2 avatar berberic2 commented on August 16, 2024

Seems to work.
Thanks.

from freecad-render.

howetuft avatar howetuft commented on August 16, 2024

Fine, thank you! I close the issue.

from freecad-render.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.