text:
Storing more data with stencils
How can I make a stencil control more than one textures? I got it to work with only one but each image has 4 channels for RGBA so how can I use them all separately?

Use compositing nodes in blender to for pixel image processing.  We  used a

[Separate RGBA Node] and selected the R .. Red Channel.

Create an image sequence if that suits you.

In the image above we used a 3D scene with red and green object.
In the compositing node view.  We view the red channel as intensity gray ...for red ball.  The green ball appears as black. I have clicked on a particular node to change the backgroud image of the nodes.
In the lower left is a file input if that suits you for a image on your hard disk.  Otherwise you could map your images onto a plane.
I did not connect the file composite output ... so I could have many images in one screen shot. Connect the image you want to the final output.
There are many good videos on a video site such as youtube as a random example. Search Blender Compositing Nodes.  Once you see a video these nodes will seem simple.  Please excuse my noodle soup.


text:
How to manipulate individual median points in edit mode?
Let's say I have some faces on the same plane that are part of a larger object and I only want to scale their individual median points outwards without deforming them. How do I achieve that? I noticed that there is the option "manipulate center points" but unfortunately that only exists in object mode.

From what I can tell from your rather unclear question, what you are looking for is the pivot point menu.
Select individual origins after selecting your faces, then you will be able to scale the faces around their center pivot point.
Like this:
Select Individual Origins

Using the default Median Point method
(scales around the net center of all selected faces)

Using the Individual Origins method
(scales around the individual faces origins)

If this is not what you were looking for, please let me know.

Close but not exactly. Each face has a median point and all these different faces' median points have another main median point. If you use the first method then the faces will grow larger as well. That's what I don't want. I only wanna scale the distances from the main median point.

It is complex if you wanna get a perfect looking result easily and/or have lots of them to move. The closest I have gotten is to move/scale them using the first method by typing the factor x and then scale them down using the second method with factor 1/x. I just use it quite often and I was wondering if there's a more straightforward way that will also enable me to use the mouse instead of typing factors.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

sort: votes


text:
How to create this kind of spiral tube?
I've modeled this example manually by extruding to show you what I mean, but its obviously neither a fast nor a perfectly accurate way. So how would you do it?

Are you looking for a purely procedural way, or would you go for a faster way to model it by hand?

I was hoping for a procedural way using modifiers or something along those lines.

One way to do this is with a curves addon.
Go to the user preferences by pressing CtrlAltU. Under Addons type "extra" into the search field. Enable the checkbox of "Add Curve: Extra Objects".
This will give you some additional options to create curves.

Now go back to the 3D view and press ShiftA to add a new object and select Curve->Spirals.

In the Tools shelf (the menu on the left of the 3D view that is toggled by pressing T) settings for the spiral will appear. Play around with them until you are satisfied with the shape of the spiral. You probably want a spiral of type 1 or 2 and a "Curve Type" of 1 (for smoothness).

To give the spiral some thickness you will have to add a taper object to the curve. Go to a new layer and add a Bezier Curve. The distance of the curve from its object origin will represent the thickness of you spiral along its length. For a linarly increasing thickness edit the curve to look something like this:

The shape around the spiral is determied by a bevel object. Just add a "Circle" curve. It does not matter if it is a Bezier Circle (just called Circle in the menu) or a Nurbs Circle.

Go back to the layer with the spiral and select the spiral. Go to the curve settings and select the bezier curve from the other layer as "Taper Object" and the circle as "Bevel Object".

The result should look like this:

You can play around with the shape of the taper and bevel object to achieve diffent effects. To close the end of the spiral you can also enable "Fill Caps".

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Scattering and anisotropy usage
Apart from artistic purposes, what are some practical uses of negative, zero or positive anisotropy? I do understand how it affects the scattering direction but I am not sure when is it useful.

What qualifies as a "practical use"? If you think about it, most of blender can be considered "for artistic purposes"...

I was referring to photorealism and how is it helpful to simulate an existing phenomenon.

Cookware, hair/fur, Christmas decorations are the obvious things that come to mind.

Im talking about volumetrics not about the anisotropic bsdf.

The Blender documentation says:

Volume Scatter lets light scatter in other directions as it hits particles in the volume. The anisotropy defines in which direction the light is more likely to scatter. A value of 0 will let light scatter evenly in all directions (somewhat similar to the diffuse BSDF node), negative values let light scatter mostly backwards, and positive values let light scatter mostly forward. This can be used to shade white smoke or clouds for example.

The Vray documentation adds some examples:

Most water-based materials (e.g. skin, milk) exhibit strong forward scattering, while hard materials like marble exhibit backward scattering.

Anisotropy is the scattering direction depending on which way the light ray is moving. If we input positive values in Anisotropy node, it will scatter the light beams in the direction the original light beam is traveling.
The exact opposite of this: if we enter a negative value, it will scatter in the direction opposite to the original light beam direction.
By setting it to 0, it will scatter randomly in any direction, irrespective of the original light beam direction.
For more information, have a look at this link below :
http://blenderdiplom.com/en/tutorials/all-tutorials/582-cycles-volume-scatter.html

wow, that link has a lot of examples, exactly what I was looking for.


text:
Xray and distracting geometry
I want to retopo an object so I tried using the Xray option to make my new mesh appear in the viewport in front of others. However I don't want to be able to see on my new mesh faces that are facing away from the camera or are behind other faces as it's making the process pretty hard. How can I do this?

There is a property called 'Hidden Wire' which I think might do what you are talking about. When you are in edit mode the option will appear in the 'Properties' toolbar in the 3D view (N) in the 'Shading' panel:

This will change the object into a wireframe shaded mode (so make sure you turn off any other wire/x-ray properties you may have turned on for that object) but will occlude faces behind the object.
Here I have turend on 'Hidden Wire' while in edit mode of a sphere. The sphere has turned to wire so I can see the object within it, but I can't see the other side of the sphere:

Hidden wire simply hides the faces but I don't mind them showing up. It doesn't also fix the sinking part. Perhaps the original question wasn't clear enough as I wasn't even sure what I was looking for. I wanted that the retopo mesh appears on top of the original one without interacting with its surface with the exception that the back facing parts should be hidden. Something like topogun: http://fc03.deviantart.net/fs71/i/2012/239/5/0/humphrey_davis_topo_fix_in_topogun_by_wachak-d5cm4du.jpg

Ah, then I'm afraid I'm not really sure what you're asking as even what you described in the comment sounds like what hidden wire is. Perhaps my answer wasn't clear in the fact that the sphere, even though it is higher res, is in fact the equivalent of the retopo object.

It turns out that the feature I was looking for wasn't actually X-ray or at least there's another workaround. Instead I used the shrinkwrap modifier with a little bit of positive offset so that the new mesh doesn't sink into the original one.


text:
Disable save (Ctrl+S) confirmation possible?
Confirmation for Save As is logic but for Save is absurd. No other program that I use has this. How can I disable it?

I actually find this useful, as I don't have to worry about saving by mistake (maybe I'm testing something destructive such as applying a modifier or something and I don't want to worry about going past the undo limit. This actually has happened to me in programs like GIMP, but it's less of a problem in GIMP as it has infinite undo). The confirmation always appears right under the cursor, so it doesn't slow me down much (no need to aim the cursor before clicking). But to each their own, I suppose..

For me it's useless because I get used to click on it automaticaly and it doesn't prevent my "mistakes".I never need more than 3-5 undos. A helpful implementation will be delayed save with a custom interval(0-30sec.) and a button in the header for canceling.

Although I wouldn't recommend this (I always increase the version number before saving), it is possible. Open up the User Preferences and add the parameter check_existing to the save function referenced from the dialog: (Note I tested this with F2 you might prefer the other expanded dialog)

check_existing (boolean, (optional)) – Check Existing, Check and warn
  on overwriting existing files

You have a bunch of versions of each project? Doesn't that fill up your hard drive pretty fast? Why don't you use some sort of version control for that? http://cgcookie.com/blender/2013/08/20/using-mercurial-version-control-with-blender-projects/

It works only for SaveAs file dialog but not for Save with Ctrl+S shortcut.

@Jusin Just to make sure that I can get back to a previous version, sometimes I mess things up and notice it hours later when the undo can't no longer help. I would use VCS if it were integrated to blender, I delete the intermediate result when I finished a model.

@user3444 Yes, the console prints search for unknown operator 'WM_OT_save_mainfile(check_existing=False)', 'wm.sav
e_mainfile(check_existing=False)' `I don't understand what makes the difference here

@stacker How to disable the “Save Over” popup- the last answer here might give you some idea. Because of the formulation I didn't find it at first before I ask the question.

@user3444 Thanks, now I remember the thing. This also means that this question is a dup.


text:
Should I use Metaballs for hands and hair?
I've been trying to teach myself to use Blender so I can make models of my characters, animate them in 3d space, and render them as though I had hand drawn them in 2d. I've been making a lot of progress setting up my line art to look like what I draw using the freestyle option, and making a shader that will do the shading like I normally do, and I'm attempting to mimic my normal art style.
I've been thinking about what else I need to figure out how to do to successfully mimic my art, and I noticed that when I draw hands, I don't draw line art between the fingers where the fingers are touching. This is a tip I learned a long time ago, and it looks really good. I do a similar thing with locks of hair. I was trying to think of how to make my models render this way, and I thought Metaballs might be a good idea, since they fuse when they touch. But the more I look into it, it seems I can't model Metaballs until I bake them into a mesh? At which point it can no longer fuse?
I would like to have a model made with geometry, where the fingers are either made of Metaballs, or have a thin layer of Metaball around them, so that I can animate my character and have the fingers fuse when they touch. And do something similar with the hair, having the hair made of Metaball, so that locks fuse when they touch. Is this possible? If not, does anyone have recommendations for alternative methods. I'm a noob, and am trying to learn all I can.

Oops, I thought they were called meatballs , should I edit my original question?

it's okay I already did XD

Metaballs are too feature limited and not performant enough for most uses. See examples https://blender.stackexchange.com/questions/194011/is-there-any-technique-to-give-a-metaball-effect-to-the-particles-emitting-from https://blender.stackexchange.com/a/244710/19307 https://blender.stackexchange.com/questions/94502/animatable-soft-transition-between-sphere-and-cylinder/

I finally got a chance to go test it... it seems metaballs do not play nice with freestyle lineart

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Animation not rendering (viewport still fine) & Random per island changes color on every frame
Somehow my animation is not rendering, it just render every frame I tell it to but no change in actual object movement. The playback in viewport is running fine.
Also, I used random per island to assign random color to each sphere, but when I render on random frames their color kept changing randomly, how can I make the color stick to each sphere throughout the entire timeline?
Link to my .blend file
Edit: I solved the not rendering animation problem with Realize Instances node in geomatry node editor. But the colors are still changing every frame.

pls provide blend file because we have no idea what you did except for this one shader node. I just can assume that you generate new islands somehow....

Thanks for responding, I added a link to my blend file

uhm....there is no color change when i start your file...maybe you wanna download 4.0alpha version? or...what version r u using?

@Chris The screenshot says it's version 3.6.0

using 3.6 right now, could you try rendering a few frames? The issue I'm facing is not in viewport but in rendered images (especially around the 45-65th frames, when the spheres begin to separate). Appreciate your help!

@Chris also I just tried 4.0 alpha, the issue remains

well...i see no color change here....[1]: https://i.sstatic.net/e5Dbu.gif so maybe the windows version has a problem...i am working on a macbook

@Chris Of course it won't exhibit any change in your gif, the Random per island node is Cycles only, If you want to replicate the issue, you can try rendering in Cycles

ah ok...sorry, will take a look later

hopefully you want a solution, and not(!) that the random per island works somehow...
so here is my solution proposal:
by using this GN setup:

you create your "own" randomized per island attribute and you can use that in your shader node tree:

result (this time cycles rendering ;). ):

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Cube with rigid body does not fall
I downloaded the compound collision change example from blender demo files and just added a cube with a rigid body in there.
It does not fall at all.
I tried to delete bake and baked again -> same result
What am I missing here?
Blend file:

result of moonboots answer:

here my new blend file with moonboots proposed changes:

Please add images of your settings and interface. Information needed to provide an answer should be visible in your question, and not rely on downloading files. Thanks

i did....want to see more...or something specific?

@timaroberts: nice, that you "corrected" my text and make it worse in some parts...if you use some "automatic" tools to make uppercases, please check(!) whether it makes it right. In my case your tool capitalizes alle words of my caption which makes abolutely no sense at all. Thank you.

It is called title case as opposed to sentence case. But anyway, you are free to rollback if you wish.

You need to do 3 things:

Delete the bake:

Apply the scale of the small cube:

Choose Shape > Mesh instead of Convex Hull for your big triple cube object, otherwise it will act like a big box and it will kick out the other objects:

i did as you wrote and the good thing: the box is moving, the bad thing: everything is blowing up like an explosion.... see my pic in my updated question

Delete the bake, select the big structure and choose Mesh instead of Convex Hull and it should work, sometimes it looks like there's a refresh problem but on my computer it works. Maybe try to hide and unhide the big object to see if it refreshes?

ok, thank you very much! Now it works as expected!

so was it a problem of refresh or did you forget one of these steps?

of course my fault. I thought you meant my cube to be as a mesh object because i read too fast and too lazy...when i set the big structure to mesh it did not work either. Then i moved the cube to another collection and deleted bake again and baked ...it worked. And i am glad it did.


text:
How to put an attribute value in "from Min" from "Attribute map range" node?
Is it somehow possible to put an attribute value in From Min/From Max?

What i want is to have control over e.g. scales of all distributed instances.
i want to scale them randomly...
e.g. from start frame between 20 to 100 and
with end frame between 120 and 150
and scale randomly.
So every instance should scale different (different time + duration).

I think not. Those are fixed float parameters, not per-element. Can you give an idea of  your particular case? Maybe there's another way.

Not as far as I know.

@RobinBetts: i improved my question. See example here: [1]: https://i.sstatic.net/c9y8y.gif. there i scaled each individually randomly...but it was a pain in the ass with a lot of nodes :( if i could have attributes, it would be much easier

The Map Range operation is basically a shortcut to a number of mathematical atomic operations.
You can emulate its behaviour by using regular Attribute Math Nodes.
Using the formula from the first link I suggested, I laid out the algorithm :
output = output_start + ((output_end - output_start) / (input_end - input_start)) * (input - input_start)
<=>
output = To Min + (To Max - To Min) / (From Max - From Min) * (input - From Min)

We then just need to do the operations linearly.
Let's create a node group in order to reuse it wherever we want.

First operation, calculate input - From Min

Then, From Max - From Min

To Max - To Min

(To Max - To Min) / (From Max - From Min)

(To Max - To Min) / (From Max - From Min) * (input - From Min)

Finally, (To Max - To Min) / (From Max - From Min) * (input - From Min) + To Min :

for the sake of tidiness, remove the unneeded attributes, and output the geometry.

Here's a simple setup to generate a bunch of attributes to test out our node group.

Plug everything up, and use a control regular Map Range node to test it.

Use the new Spreadsheet Editor to analyse the data.

It's the same, yay !
Caveats, possible improvements :

This group only accepts attributes. You could theoretically tweak it to accept floats with a Switch node (Blender 3.00 +), but the sheer number of possible configurations would make the node group very big and convoluted.
This is a linear interpolation, meaning you would need to change the algorithm to add a damping coefficient if you want a smoother interpolation.
Add an Attribute Clamp node at the end if you want the possibility to clamp output

Grab the file to test out the node group :

and here the attribute clamp node:

looks very promising...i check this out...!!

Of course. Perfect.

That's amazing! Thank you Gorgious! Works perfect...!! Just a little comment ;) The attribute clamp as it is wouldn't help, because it doesn't allow attributes in min and max, right? so i would have to "rebuild" this on my own like you did with the map range node. Or am i missing something?

@Gorgious: i added the nodetree for the attribute clamp node in your great answer. Hope that was ok for you.

@Chris Sure thing, thanks :)

by the way: your answer freed me from felt 40 superfluous nodes....! ;)


text:
how to colorize the water?
I made a water simulation.
I also use an HDRI to light the scene because it is easy to use and looks great.
Unfortunately the water "mirrors" the HDRI background which isn't blue which looks kind of "bad". I want to have blueish color.
So i thought, i could add a blue plane around/under the water so it reflects the blue from there.
Unfortunately it does not (in Eevee).
Anybody an idea how to get what i want?
@Moonboots: Thank you very much for your answer. At least now i can change the color. ;) But... now my "water" looks like this (see image)
I hoped the water would somehow reflect that color that it still looks like water...

UPDATE2: @moonboots: i am sorry, but the file is too big because of HDRI i think, so blender stackexchange didn't work, your proposal does just accecpt until 24MB ...it is 105 MB ...so to be quick i used dropbox, hope you don't beat me
https://www.dropbox.com/s/03591rpn34wwgth/blue_water_test.blend?dl=0

Use the Light Path node: https://blender.stackexchange.com/questions/145392/use-a-hdri-just-for-lighting-and-change-the-background-color?noredirect=1&lq=1

thanks moonboots, i tried, with no luck, but i will keep on trying ;)

mmh I've just tried and it works fine, so maybe tell a bit more about where it fails

well...the water has still the color of the HDRI background, .....don't worry, i will try...if i know more i will update my question. Thank you for your help!!!!

See my answer, I show the node setup, this is not the only solution but this one should work

please pack your images and share your file: https://pasteall.org/blend/

aye aye Sir! But i had to use dropbox :(. -> updated question

see my edit, if the problem is that the color is bad you can change the color or use a node setup with noise or another HDRI

alright.........

Also you may need to work a bit on the water material but it's another problem  ;)

Here is a node setup that works, use an Input > Light Path > Is Glossy Ray to reflect the color (or the HDRI) you want but you could use other methods as well:

From the file you share, if you want a nice color and reflect, just plug another HDRI in the second Background:

thank you!! Now i learned how to change the color, which i didn't know before and how to just use the lighting of HDRI. Unfortunately now the water doesn't look like water anymore (i updated my question)

The water reflects the environment: The ocean looks blue on clear days and gray on cloudy ones.
Look for an HDRi that has clear sky in the area that is reflected by the water.
Or use a second HDRi that is used for reflections only.
Read:
How to use multiple HDRIs

i am sorry susu, but this is not a solution for me. This is a cheap workaround, which does not fullfil my needs, because I cannot exactly choose the colors i want to have, just the ones which provides the HDRI. But thanks for the answer anyway.


text:
How to rotate my points so that they point outside like windows on a building?
Is it possible with geometry nodes and a grid node

with some "clever" math so that the outer "boxes" rotates to "outside"?
Or easier:
i have this:

and of course i want the windows to be on the outside and not all in one direction.
I have this basic little setup here:

and of course the windows should be on the "small side" as well as on the "long" side.

for the "corners" i have a solution, but not for the rotation of the cubes for the 4 sides.
I have two geo-nodes modifiers, the second one is just this:

Can you show us a little more context to what you're doing?  How you want to make/place the cubes?  The simple solution is to instance a mesh that has windows on all 6 sides.  You will need at least 2 sides, for the corners, even if creating the mesh completely procedurally (no instancing.)  But everything depends on the limits you impose on the problem.

good idea with windows on all sides ;) sometimes the easiest solutions are the best. Yes, i will update my question.

Do you also want cubes inside the grid perimeter ?

@Gorgious: It can but it doesn't have to be. I don't really care.

With your updated geonodes setup, how are you then creating the cubes?  Are you point instancing another object?

@Nathan: i updated my answer, sorry. Just a point instance, yes.

I nicked Nathan's idea of normalising the grid positions from -1 to 1 in X and Y, so credit goes to him for that, not here, please.
Then, by rounding the positions towards 0, you can interpret them as vectors to align to directly, without further work:

.. unfortunately, Attribute Vector Math doesn't provide an element-wise round, so we have to make our own.
Ocasionally, at some dimensions, this method does flip out. (I think, divisions by 0 at some values?). I'll try to fix that .. any suggestions would be welcome, of course.

Blender 3.0a

wow...this is a really short solution....love that!!!

don't beat me...just by trying out - i have no idea what i did - if you change scale from .5 to .49999 ...it works! :D

@Chris Thanks! Yes.. looks like floating-point error on the Floor. Sometimes 0 when it should be 1. (There's a chance your fix doesn't work at all scales, I suppose.) Will have to check it out.

@Chris BTW.. this answer is entirely dependent on Nathan 's. If you're handing ticks out at any stage, you should prefer his answer to mine. :)

I am still struggling with realizing his answer…because he connected a node which is impossible…

Sorry, but i have to give you the correct answer because yours works and i could try out with your blend file. Nathan's solution i could no reproduce because he connected some really weird node there ...i asked him...but no answer...but he got a +1 anyway from me for his effort

but maybe you know how he successfully connected a value (!) with an attribute !? without Blender complaining!? did you see that?

This is good!  There should be a safe you amount you can upscale your unit grid, something like verticesX/(verticesX-1), etc.  And you deserve your check :)  Solutions don't spring fully formed from the rib of Adam, but they're no less notable for that, and simpler solutions are better.

@Nathan Thank you! I hate treading on toes.

@RobinBetts: needed some time, but now i understand your solution which is really great! And i love the "simpleness" by which i mean just the few nodes!! And i am happy that Nathan "sees" it my way although you used parts of his solution. Your solution is prette genius!!!

@Chris What can I say? I'm touched. Thanks!

You deserve it!!!

Okay, so like I said in comments, the easiest solution is to instance a cube with 6 windows.  And if you want a single window, you're going to have problems at the corners.
But, I think part of the point to this, for you, is gaining a better understanding of how to handle problems in geonodes, so I treated this as a more abstract problem than that.  The problem is, how to align point rotation orthogonal to a grid?
It's a little bit complicated when you just look at the nodes.  That's because there are quite a few repeated elements.  When you organize it mentally into separate processes, it ought to make more sense.  But without further ado....

So the first question is, how do we divide our points into four groups by facing?  We're going to be doing that by looking at the dot product of their position with arbitrary vectors (the +X vector and the +Y vector).  That will let us know which quadrant they belong in.  After we assign quadrants, we can separate these points into four groups and rotate each group with a different rotation.
That's the basic plan.  Let's talk about some of the nitty gritty.
The first thing I do is to create a rescaled copy of my position.  That's because if verticesX and verticesY disagree, the angles defining my quadrants won't actually be at 45 degrees.  By scaling my grid back into a square, no matter what its original dimensions, the quadrants will be properly represented at 45 degree angles.  I store this temporary position in an implicit attribute I named "squaredPos".
After that, I do a bit of separation and combination to eliminate the Z component of squaredPos.  This is because I anticipate you're going to want multiple stories.  The angle we're interested isn't actually the angle from the origin-- it's that angle, projected onto a Z plane.  So by eliminating the Z component, that's what I'll get.
Then, we have to normalize this vector so that we can compare it to our arbitrary vectors.  The dot product of two unit-length vectors is the cosine of the angle between those two vectors.  These angles define our quadrants.  The cosine of 45 degrees is 0.707-- the square root of 2, divided by 2-- which is why we're testing for those values.  (The cosine of 225 is  -2^0.5/2.)
We assign our points into four different groups based on the values of our two dot products, then we use these groups to separate our points into four different sets of points that we can rotate.  Finally, we rejoin all of these points and instance our geometry.
Note what I was saying: the corners aren't right.  These corners are places where the dot product was exactly 0.7 or -0.7-- they fit into two different categories.  If we really wanted, we could actually create four more groups-- points that fit into multiple facings-- and rotate and instance new, different geometry based on these groups.  That would make this tangle of nodes even harder to understand though, and I think if you understand the processes of what I've described so far, you should be able to reason your way there.

Thank you for your answer which i try to rebuild. Unfortunately i don't know how you did this: [1]: https://i.sstatic.net/xXb8Q.png -> the right most node is connected to a value although A is an attribute!? how is this possible?

@Chris Oops, a bug.  I updated the picture.  It should have been connected to B, with "dotPlusY" as the attribute-- should be visible now.  In this case, that node doesn't actually do anything meaningful, it only demonstrates the assignment of "front", while later nodes don't use front (it's merely what's left over after separating out back, right, and left.)

Ok thank you but I am curious: how could you make that picture without getting red noodle? Did you copy a node above it?!

@Chris Dunno.  I just plugged things in.  Guess Blender failed to warn me about my bug.  (Maybe, because the attribute was unused, it ignored the node, and so it never triggered any "compiler warnings.")


text:
Fill selection with select more via Python
I want to fill out the selection I have. So from the active face I want to select more a lot and deselect the normal selection after every iteration.
How often it should use the select more command is not important, since my selection that I give should stop the select more command from selecting to much.

So the script should do this:

From my selection it selects only the active face
Selects More command
Deselects my selection I started with except the active face
Repeat 2. to 3. for x times

I could not do it. I tried it with bmesh but I don't understand how it works.
Here is my code so far:
import bpy

growAmount = 30
obj = bpy.context.active_object
if bpy.context.object.mode == 'EDIT':
    bpy.ops.object.mode_set(mode = 'OBJECT')
    bpy.ops.object.mode_set(mode = 'EDIT')

selectedFaces = []
activeFace = obj.data.polygons[obj.data.polygons.active]

for i in obj.data.polygons:
    if i.select:
        if i.index != activeFace.index:
            selectedFaces.append(i.index)

bpy.ops.object.mode_set(mode = 'OBJECT')
for i in selectedFaces:
    obj.data.polygons[i].select = False

for i in range(growAmount):
    bpy.ops.object.mode_set(mode = 'EDIT')
    bpy.ops.mesh.select_more(use_face_step=False)
    bpy.ops.object.mode_set(mode = 'OBJECT')
    for i in selectedFaces:
        obj.data.polygons[i].select = False

bpy.ops.object.mode_set(mode = 'OBJECT')
bpy.ops.object.mode_set(mode = 'EDIT')

It works okay but leaves edges selected that I don't want.

Not the ideal code solution but it works:
import bpy

growAmount = 30
obj = bpy.context.active_object
if bpy.context.object.mode == 'EDIT':
    bpy.ops.object.mode_set(mode = 'OBJECT')
    bpy.ops.object.mode_set(mode = 'EDIT')

selectedFaces = []
selectedEdges = []

activeFace = obj.data.polygons[obj.data.polygons.active]

for i in obj.data.polygons:
    if i.select:
        if i.index != activeFace.index:
            selectedFaces.append(i.index)

for i in obj.data.edges:
    if obj.data.edges[i.index].select:
        selectedEdges.append(i.index)

bpy.ops.object.mode_set(mode = 'OBJECT')
for i in selectedFaces:
    obj.data.polygons[i].select = False

for i in selectedEdges:
    obj.data.edges[i].select = False

for i in range(growAmount):
    bpy.ops.object.mode_set(mode = 'EDIT')
    bpy.ops.mesh.select_more()
    bpy.ops.object.mode_set(mode = 'OBJECT')
    for i in selectedFaces:
        obj.data.polygons[i].select = False
    for i in selectedEdges:
        obj.data.edges[i].select = False

bpy.ops.object.mode_set(mode = 'OBJECT')
bpy.ops.object.mode_set(mode = 'EDIT')

bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='EDGE')
bpy.ops.mesh.select_mode(use_extend=False, use_expand=False, type='FACE')


text:
How to find name of a nodes type to create with python
I would like to create a ColorRamp node, but I don't know how it is called internally.
import bpy

selection = bpy.context.object
currentMaterial = selection.active_material
currentMaterial.use_nodes = True
nodes = currentMaterial.node_tree.nodes
colorRamp = nodes.new(type = 'ShaderNodeColorRamp')

The 'ShaderNodeColorRamp' does not work, the string is wrong, how do I find it's correct name out?

When creating the node via the search menu, the info area only say:
bpy.ops.node.add_search(node_item='69')

I mean it's more to know how to get the name of any node.
So the duplicate helped only a bit.

Mostly agree. Hence the title edit... please clean up the question code , eg add imports etc to make minimal running example   so wrong type name is the error and  will reopen. Another way is via python console after adding node, but in that case may as well enable python tooltips as shown.

Re your last edit, think you are confusing the python console with the info area, plus you are adding via search, not as below directly via menu.

But the python console does not say anything, it is just almost blank for me

It's ShaderNodeValToRGB.
Turn on Python Tooltips under Edit > Preferences > Interface. Then go to the Shader Editor and hover over a node in the Add menu to see a tooltip with the name.

Out of interest, are you able to screenshot the tooltips directly?  For me have to make a gif then screenshot the tip from gif, since on linux the print screen is sans tooltip.

Yeah, it's caught no problem. I use scrot for screenshooting.

Or Lightshot on GitHub

To answer comments under question, In addition to using the tooltips, as demonstrated in accepted answer.
Python console.
Use the python console to directly input python code and get instant feedback. In example below, typing the variable mat into console, echos the representation of its value.  IMO this is one of the strengths of a scripting language like python, can get feedback without compiling
In this example looking at the active material of the active object
>>> mat = C.object.active_material
>>> mat
bpy.data.materials['Material']

>>> for n in mat.node_tree.nodes:
...     n.name, n.type, n.__class__.__name__
...
('Principled BSDF', 'BSDF_PRINCIPLED', 'ShaderNodeBsdfPrincipled')
('Material Output', 'OUTPUT_MATERIAL', 'ShaderNodeOutputMaterial')
('ColorRamp', 'VALTORGB', 'ShaderNodeValToRGB')

the last node listed named "ColorRamp"  with enumerated type 'VALTORGB' is an instance of class bpy.types.ShaderNodeValToRGB
Could iterate over all materials
for mat in bpy.data.materials:
    if mat.use_nodes:
         <as above>

The Info window.
If the node is added as shown in accepted answer (not via the search for nodes menu) then

bpy.ops.node.add_node(type='ShaderNodeValToRGB')

as described in accepted answer.


text:
Rename selected collections and objects
I would like to rename every collection and object I currently have selected.

Code:
import bpy

selection = bpy.context.selected_objects
for x in selection:
    x.name = 'test_' + x.name
    x.data.name = 'test_' + x.data.name

But the variable selection does not have any collections in it.

Only renames active collection and selected objects:
import bpy

def testFunction():
    selection = bpy.context.selected_objects
    for x in selection:
        x.name = 'test_' + x.name
        x.data.name = 'test_' + x.data.name
    collection = bpy.context.view_layer.active_layer_collection.collection
    if collection.name == 'Master Collection':
        return
    collection.name = 'test_' + collection.name

if __name__ == '__main__':
    testFunction()


text:
Choosing right context for property in viewport panel
I have a simple panel that you can see in the viewport which is a shorter version of UI Panel Simple.
Seeing from other panels, by using Edit Source, they all define a context where the property is added, but how do I decide which one to use to get it working?
Using Blender 2.92.
import bpy
from bpy.props import BoolProperty

class HelloWorldPanel(bpy.types.Panel):
    bl_label = "Hello World Panel"
    bl_idname = "OBJECT_PT_hello"
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'UI'
    bl_category = "Tool"

    def draw(self, context):
        layout = self.layout
        row = layout.row()
        row.label(text="Hello world!", icon='WORLD_DATA')

class QuickRename_PT_Panel(bpy.types.Panel):
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'UI'
    bl_label = "Quick Rename"
    bl_category = "Tool"
    bl_parent_id = "OBJECT_PT_hello"

    testBool: BoolProperty(
        name = 'Test',
        description = 'Test description',
        default = True,)

    def draw(self, context):
        layout = self.layout
        layout.use_property_split = True
        layout.use_property_decorate = False

        tool_settings = context.tool_settings

        row = layout.row()
        row.prop(tool_settings, 'testBool')

def register():
    bpy.utils.register_class(HelloWorldPanel)
    bpy.utils.register_class(QuickRename_PT_Panel)

def unregister():
    bpy.utils.unregister_class(QuickRename_PT_Panel)
    bpy.utils.unregister_class(HelloWorldPanel)

if __name__ == "__main__":
    register()

I want to add the testBool property to the Hello World Panel.

But I think the
tool_settings = context.tool_settings

is wrong.

We do not declare properties in panel classes. Either use a property group or register your property directly to the scene: https://blender.stackexchange.com/questions/57306/how-to-create-a-custom-ui

or AFAIK also not on any non ID types (those in bpy.data collections like Objects, and bones)   eg bpy.types.ToolSettings.test_bool = bpy.props.BoolProperty() then  in python console type in  C.tool_settings.test_bool  If it is not True or False '  can't do it.

Yes, thats why I added the answer with the link to How to create a custom UI? and working code

Okay by looking at How to create a custom UI? I could figure it out
import bpy
from bpy.props import BoolProperty, PointerProperty
from bpy.types import PropertyGroup

class HelloWorldPanel(bpy.types.Panel):
    bl_label = "Hello World Panel"
    bl_idname = "OBJECT_PT_hello"
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'UI'
    bl_category = 'Tool'

    def draw(self, context):
        layout = self.layout
        row = layout.row()
        row.label(text="Hello world!", icon='WORLD_DATA')

class QuickRenameProperties(PropertyGroup):
    test_bool: BoolProperty(
        name = 'Test',
        description = 'Test description',
        default = True)

class QuickRename_PT_Panel(bpy.types.Panel):
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'UI'
    bl_label = "Quick Rename"
    bl_category = "Tool"
    bl_parent_id = "OBJECT_PT_hello"

    def draw(self, context):
        layout = self.layout
        layout.use_property_split = True
        layout.use_property_decorate = False
        scene = context.scene
        mytool = scene.my_tool

        row = layout.row()
        row.prop(mytool, 'test_bool')

def register():
    bpy.utils.register_class(HelloWorldPanel)
    bpy.utils.register_class(QuickRename_PT_Panel)
    bpy.utils.register_class(QuickRenameProperties)
    bpy.types.Scene.my_tool = PointerProperty(type = QuickRenameProperties)

def unregister():
    bpy.utils.unregister_class(QuickRename_PT_Panel)
    bpy.utils.unregister_class(HelloWorldPanel)
    del bpy.types.Scene.my_tool

if __name__ == "__main__":
    register()


text:
Is Blender the only open source Non-destructive editor?
Blender's "Nodes" function seems to make it a non-destructive editor.
The "Mix" node enables the user to composite using "blend modes".
For me, the "Add" blend mode is the most important of these blend modes but often it the Add blend mode is not included in compositing tools.
This and the fact that Blender is seemingly non-destructive is the reason I'm using Blender.
I am currently using Blender as a 2D compositor only, meaning that my "RenderLayers" nodes provide Blender with an image that mocks a 2D vector (as though I were using Adobe After Effects's "Shapes" tool to composite onto image/video). I have always to ensure the camera is pointing 100% downwards i.e. in-line with the z-axis.
The problem is that Blender takes a long time to composite; The whole process seems extremely inefficient when I compare Blender with Adobe After Effects.
Please could you advise me on whether I should quit using Blender for this application?
Thank you for your time

Whether you continue to use Blender or not is entirely your choice. As for some compositors not including the "Add" blending mode, try looking for "Linear Dodge", "Linear Blend" or even "Screen", as they are very similar or the same.

If you are just using it for compositing existing 2D images, you might get a speed boost by using an image node to include your images.

If the problem is only performance, Blender can also leverage OpenCL running on the GPU and CPU to speed up the node compositing. From my experience, it significantly speeds up the process.
You can turn it on in the node editor panel.


text:
Why raycast works with a reverse ray direction?
I'm a HOUDINI user and I know how exactly Raycast works, but in my case, something odd is happening. I think Raycast does not work correctly, when I use a reverse direction I can see the result. you can see everything in the image below:

by the way, in my case hit position does not work, it gives me zero for all points.
in the end, I checked my issue with Blender 3.4 and 3.6 and both of them are the same.

In this setup, the grid is the starting point, and the torus is the target, so $(0,0,1)$ is perfectly correct. And hitPosition is $0$ because you have already deleted the points one step before with Delete Geometry.

You mean I have to connect the torus position to the raytcast source position?

The fields (rhomb sockets) are evaluated on the geometry that uses it. The "target geometry" in the raycast node is what the ray will detect intersection with. Therefore it goes up from the plane to the target deleting points on the geometry that the rays where cast from.

Thank you all.. The way Houdini raycast works is different, That's why I confused a littile


text:
Points around points on curve
I have this curve where I've sampled points on, then with a Sample Curve node I used the tangent and normal information to place instances oriented the right way on this curve. Now I want to place points around each of these instances and orient them with the same normal and tangent.
I don't know how to get the second set of points around each one of the first set of points. That the displacement of each second set points is identical with relation to each other is not a problem.
This what I've managed so far:

We have the green buckets that are placed around the curve and a single set of instances nearby which I want to replace by the group of points provided by the set of points in the center.
And these are my Geometry nodes:

Plus some nodes off-screen that facilitate the movement of the buckets, but that's not important for now.
The "Content" group is placing those single set of instances above the buckets that I want to replace by the points from the "Content-Spread" group.
What would be the easiest way to place those 15 points at the position of each Content instance?
Here's my blend file:

to attract more people to your question i recommend providing a blend file so we don't have to rebuild everything manually. You want help right? so i would - if i were you - make it as easy as possible for those people, who are willing to answer you for free in their spare time...

Sure thing! I removed all unnecessary stuff from the project and uploaded it. See the bottom of my post.

i am really not sure what you mean, but hopefully this (if not, please add a sketch or picture how it should look like):

result:

what i did, is just distributing points on faces after realize instances on a grid, which i just added as instance as you added the other instances.
i just hope that helps.

I can work from that. Thanks!

you are welcome!


text:
How to use multiple attractors to move objects with Geometry nodes?
I'm trying to create a node setup that will allow me to effect the density of a set number of instances along a curve with multiple attractors.  I have a setup using one attractor that is working pretty well, however, I can't implement any more without causing strange effects that I can't solve.
Bonus points if you can tell me how to restrict the movement of the instances so that they do not move beyond the curve from which they are instanced on.

The second attractor isn't hooked up here, but it would usually just be plugged into the second set position node

You could convert several objects from a collection into points and use them for Geometry Proximity.
You can then use the resulting distance value as a multiplier of the direction to the nearest object.
Something like this:

Note: This solution is not perfect, however, because too large an area of effect will move an object either one way or the other, depending on which object is closer.
(Blender 3.6+)


text:
how can i add the viewer node to the shader editor?
I know "normally" shift-ctrl left mouse click -> viewer node will be added.
I am using 3.3. alpha version and a mac and it doesn't work anymore.
Any suggestions?
Node wrangler is enabled.

i am a bit concerned that it might be because shift control left mouse is double used: select toggle and preview node...
i deleted all double for shift control -> didn't work either :(
it's not a hardware problem -> 2.93 is working that way

Do you have the node Wrangler addon enabled?

yes of course ;)

Just checking! :^)

i know...i wanted to just answer yes...but i wasn't allowed... ;)

I assume you've checked node wrangler's settings in Preferences -> Add-Ons -> Node: Node Wrangler -> Show Hotkey List to see if the setting changed?

:^) Sounds as if it may be a bug in that case, but since I a) don't have a Mac and b) don't have 3.3 Alpha installed....

it says: [1]: https://i.sstatic.net/gyCzo.png ...and that worked always... :(

shouldn't be a bug...because that worked :( so maybe i have accidentally killed it somehow

i opened a bug report...i have no idea... :(


text:
Add vertices or Faces
how do i fix the gap in my cats nose? there are also holes in the legs that i would like to patch up. :)

If you select 2 vertices and press F, a new edge between the vertices is created.
If you right click on it and choose subdivide you can add 1 or more vertices to that edge.
If you select 4 vertices and press F, a face will be created.

I made a quick video demonstrating how you'd go about doing something like this. I hope it helps! If you need more help then feel free to ask
Remember that, if you know that certain parts are going to be animated, then use quads and stay away from triangles. This seems pretty low poly though but quads are always preferred when creating organic things such as this.
Demonstration


text:
how to render animation in background on mac
i try to render my animation in background with this command:
blender -b /Users/cd/Downloads/name.blend -x 1 -o // -a
Unfortunately it renders just a still image as animation. so it is a .mov file, but no animation at all.
the animation has some physics in it -> maybe ...do i have to bake it first!?
If i render it manually in Blender it is an animation. What am i missing here?

If you go this route, I'd recommend render to an image sequence in the first place and then compile the sequence into whatever you need using ffmpeg.

ok, thanks, i try

unfortunately it does not help....it renders to a specific frame, but then it stops :(

Just add -a eg. blender -b file.blend -a, see: https://docs.blender.org/manual/en/latest/advanced/command_line/render.html

i have a -a at the end.....see my question...i got lots of images...but they are all the same

ok, i baked the dynamics and then it works...but i think this is a bad solution, if i first have to bake it in blender and then i call the animation process in terminal....would be better if i could bake it in the terminal too...
but now i found this answers, which hopefully helps me a lot...
Baking smoke on headless machine


text:
why does Blender render an image in the compositor?
Compositor beginner here:
I have this compositing node tree:

why does Blender render my second viewlayer, although i don't use it in the compositor?

My stupid assumption was, that i could render faster (i had the VL2 layer before instead of the image input), if i just use a static picture as background. But looks like Blender doesn't think like i do....umpf
EDIT:
if i disable the render buttons in VL2, it does what i want.
But really i hoped Blender does something like in GN, if nodes are not used, it wouldn't execute it :(

Are you sure you haven't loaded it in the Video Sequencer?

yes i am sure....

You should not have to disable anything in VL2 if it is not selected in the Render Layers node

maybe make your file very simple (replace the robot by a cube) and share your file?

@moonboots Actually this behaviour is quite normal... see my answer.

Oh OK I missed it

@moonboots Well, I added a bit more explanations at the end of the answer... or let's say use cases.

In all my explanations in the answer I forgot to mention, one of the reasons view layers get rendered even though not used in the Compositor: this is post-processing. It does not affect what Blender hands over to the render engine to get rendered. It only affects the output if you plug nodes inbetween. You could also disable the Compositor to render a scene. The only thing is, if it is enabled and nothing is plugged into the Composite node (or there is none), then Blender won't render at all and give an error message for not having anything to output.

Blender renders all view layers which have Use For Rendering enabled in the View Layer Properties:

This setting can also be keyframed, let's say you have an animation where you want to use a second view layer to Alpha Over in the Compositor but only for certain frames. Then you can disable it for all other frames where you don't need it.
If you now have let's say 10 view layers and you want to render only one of them, you do not need to disable 9, in this case you can enable Render Single Layer and only this view layer will be rendered.
But: you can still use the other 9 layers in the Compositor, when they have been rendered before - Blender will used a cached render of those layers.
This can be useful if your 9 layers create a background image which does not change, and the one layer you set to Render Single Layer has an animation which you want to lay over the others.
Sidenote: the option Render Single Layer stays enabled when switching to a different view layer. This means, always the active view layer will be single-rendered.
More sidenotes: If you have both view layers in the Compositor and made changes on only one of them, you don't have to set Render Single Layer and press F12 to re-render that one layer where you have made changes when you want to keep the other without re-rendering. In the Compositor, you can just click on the Render button next to the view layer's name in the Render Layers node to re-render that single layer.
Last but not least: When you press F12 to render a scene and both view layers get rendered even though you have only one in a Render Layers node in the Compositor, you can add another Render Layers node and switch it to the second view layer and it will be used for compositing without having to render again because it had been rendered before.


text:
Change the extension in the textfield based on dropdown
I am making use of the ExportHelper to export objects either as and FBX or glTF without choosing the format beforehand.
But when I don't define the filename_ext the script does not add the specified extension to the text field input and marks the text field in red when the file already exists.
Is there a way to dynamically change the filename_ext?
Here is a tweaked ExportHelper script. Try to make the filename_ext dynamic based on the EnumProperty "Example Enum". I couldn't get it to work properly.
Having the check of the EnumProperty inside the draw function makes it behave strange.
Go to File > Export > glTF 2.0 and right click on the dropdown next to Format in the file browser and click Edit Source. Go into the Text Editor edit the new init.py and look for the function on_export_format_changed.
I am not skilled enough to implement it myself.
import bpy

def write_some_data(context, filepath, use_some_setting):
    print("running write_some_data...")
    f = open(filepath, 'w', encoding='utf-8')
    f.write("Hello World %s" % use_some_setting)
    f.close()

    return {'FINISHED'}

# ExportHelper is a helper class, defines filename and
# invoke() function which calls the file selector.
from bpy_extras.io_utils import ExportHelper
from bpy.props import StringProperty, BoolProperty, EnumProperty
from bpy.types import Operator

class ExportSomeData(Operator, ExportHelper):
    """This appears in the tooltip of the operator and in the generated docs"""
    bl_idname = "export_test.some_data"  # important since its how bpy.ops.import_test.some_data is constructed
    bl_label = "Export Some Data"

    # ExportHelper mixin class uses this
    filename_ext = ".gltf"

    filter_glob: StringProperty(
        default="*.txt",
        options={'HIDDEN'},
        maxlen=255,  # Max internal buffer length, longer would be clamped.
    )

    # List of operator properties, the attributes will be assigned
    # to the class instance from the operator settings before calling.
    use_setting: BoolProperty(
        name="Example Boolean",
        description="Example Tooltip",
        default=True,
    )

    type: EnumProperty(
        name="Example Enum",
        description="Choose between two items",
        items=(
            ('OPT_A', "First Option", "Description one"),
            ('OPT_B', "Second Option", "Description two"),
        ),
        default='OPT_A',
    )

    def draw(self, context):
        if self.type == 'OPT_A':
            self.filename_ext = '.gltf'

        if self.type == 'OPT_B':
            self.filename_ext = '.fbx'
        layout = self.layout
        layout.use_property_split = False
        layout.use_property_decorate = False  #No animation
        sfile = context.space_data
        operator = sfile.active_operator

        row = layout.row()
        row.prop(operator, 'type')

    def execute(self, context):
        if self.type == 'OPT_A':
            self.filename_ext = '.gltf'

        if self.type == 'OPT_B':
            self.filename_ext = '.fbx'
        return write_some_data(context, self.filepath, self.use_setting)

# Only needed if you want to add into a dynamic menu
def menu_func_export(self, context):
    self.layout.operator(ExportSomeData.bl_idname, text="Text Export Operator")

# Register and add to the "file selector" menu (required to use F3 search "Text Export Operator" for quick access).
def register():
    bpy.utils.register_class(ExportSomeData)
    bpy.types.TOPBAR_MT_file_export.append(menu_func_export)

def unregister():
    bpy.utils.unregister_class(ExportSomeData)
    bpy.types.TOPBAR_MT_file_export.remove(menu_func_export)

if __name__ == "__main__":
    register()

    # test call
    bpy.ops.export_test.some_data('INVOKE_DEFAULT')

ExportHelper is a mix-in-class to simplify some preselections passed to the Filebrowser, but not good for manipulating an active one. The FileBrowser itself is a tricky thing because it uses several operators and classes, like FileOperators, SpaceFileBrowser or FileSelectParams, even without ExportHelper.
Following an example of a modified FileBrowser.
First a few basic notes because I don't know which point you're struggling more. Feel free to scroll down if bored.
FileBrowser is an interface for selecting files and folders with filtering options. It does not import or export anything itself. For this a function must be called when FileBrowser is finished. In your example return write_some_data(context, self.filepath, self.use_setting) in the execute() methode passes parameters filepath and use_settings from ExportHelper to your export function.
In the export function you are using the built-in python function open() with mode write 'w'. That opens (or creates if not exist) by default a textfile with filename and extention at the location all passed from filepath and at last inserts data into the file. link There are file formats using ASCII/Text like .obj where it can make sense to save a model as textfile.
To export a blendermodel in another format you better use the right ExportOperator to avoid problems. The built-in-operators can be found in Blender API > Export Scene Operators [https://docs.blender.org/api/current/bpy.ops.export_scene.html#module-bpy.ops.export_scene]. Each of these exporters use filepath to store the file at a given location without opening the filebrowser. The gltf-exporter has an attribute export_format to select one of three output formats and embedding options.
Blenders filepath includes the entire filetree from mount to extension. Windows example: C:\Users[USERNAME]\Documents\my_model.blend
FileSelectParams filename is extracted name + extension of filepath used by
FileBrowser - same as bpy.path.basename(filepath). Example: my_model.blend
ExportHelper filename_ext is used to add a given extension to user input if none
In example there is a custom operator to call the FileBrowser, manipulate input and initiate the export. Best to test via sidebar (N-Panel).
import bpy
import os # needed for file operations
from bpy.props import StringProperty, BoolProperty, EnumProperty, PointerProperty
from bpy.types import Panel, Operator, PropertyGroup

### UI
class TESTPANEL_PT_Main(Panel):
    bl_idname = 'TEST_PANEL_PT_main'
    bl_label = "Test Panel"
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'UI' # sidebar
    bl_category = "TEST"
    def draw(self, context):
        fbprops = context.scene.fbprops
        layout = self.layout
        row = layout.row()
        row.label(text="Export Filename:")
        row.prop(fbprops, 'use_blendername', text="blendername")
        row = layout.row()
        row.enabled = False if fbprops.use_blendername else True
        row.prop(fbprops, 'file_name', text="")
        layout.prop(fbprops, 'use_filecheck')
        layout.operator('filebrowser.export', text="open filebrowser")

### OPERATOR
class Filebrowser_OT_export(Operator):
    bl_idname = "filebrowser.export"
    bl_label = "Export File"

    filepath: StringProperty(name="File Path",
                             maxlen= 1024,
                             subtype = 'FILE_PATH',
                             )

    check_existing: BoolProperty(name="Check Existing",
                                 default=True,
                                 options={'HIDDEN'},
                                 )

  # open filebrowser with custom settings
    def invoke(self, context, event):
        fbprops = context.scene.fbprops
        dir = os.path.dirname(fbprops.file_path)                                          # custom dir
        filename = fbprops.file_name + fbprops.file_formatlist[int(fbprops.file_format)]  # build filename (name+ext)
        self.filepath = os.path.join(dir, filename)                                       # build filepath
        self.check_existing = fbprops.use_filecheck                                       # set check
        context.window_manager.fileselect_add(self) # open filebrowser
        return {'RUNNING_MODAL'}

  # draw custom props
    def draw(self, context):
        fbprops = context.scene.fbprops
        layout = self.layout
        layout.use_property_split = False
        layout.use_property_decorate = False
        # use format change
        row = layout.row()
        row.alignment='RIGHT'
        row.label(text="Change Format")
        row.prop(fbprops, 'use_formatchange', text=" ")
        # format select
        row = layout.row(align=True)
        row.alignment='RIGHT'
        row.enabled = fbprops.use_formatchange
        row.prop(fbprops, 'file_format', text="")
        row.label(text="")

  # filebrowser events
    def check(self, context):
        # filebrowser opens at end of operator
        # so we need to check if open to avoid first call error
        if len(context.window_manager.windows) > 1:                                # at least two windows
            if [a for a in context.window.screen.areas if a.type=='FILE_BROWSER']: # search filebrowser
              # get params
                space = context.space_data
                params = space.params
              # change params
                fbprops = context.scene.fbprops
                if fbprops.use_formatchange:
                    basename_recent = params.filename.split('.')[0]                              # might be changed by user
                    name = basename_recent + fbprops.file_formatlist[int(fbprops.file_format)]   # build filename (basename+ext)
                    params.filename = name                                                       # set filename

    def execute(self, context):
      # store recent selection
        fbprops = context.scene.fbprops
        fbprops.file_path = self.filepath
        name = bpy.path.basename(self.filepath).split('.')[0]
        fbprops.file_name = name
        # for testpanel only
        check_names()

      # get selected export format
        export_filename = bpy.path.basename(self.filepath)  # recent filename
        export_format = export_filename.split('.')[1]       # recent format

      # export Blender
        if export_format == 'blend':
            bpy.ops.wm.save_mainfile(filepath=self.filepath)

      # export FBX
        elif export_format == 'fbx':
            bpy.ops.export_scene.fbx(filepath=self.filepath)

      # export GLB or GTLF
        else:    # gltf three different format and embedding options ; op needs gltf_format
            gltf_formats = ['GLB', 'GLTF_EMBEDDED', 'GLTF_SEPARATE']
            gltf_export_format =  gltf_formats[int(fbprops.file_format)-2]  # blend and fbx first in enum
            bpy.ops.export_scene.gltf(filepath=self.filepath, export_format=gltf_export_format)

        return {'FINISHED'}

    def cancel(self, context):
      # store recent selection
        fbprops = context.scene.fbprops
        fbprops.file_path = self.filepath
        name = bpy.path.basename(self.filepath).split('.')[0]
        fbprops.file_name = name
        # for testpanel only
        check_names()
        return

### FUNCTION
def check_names():  # for testpanel only
    if not bpy.context.scene.fbprops.blend_name == bpy.context.scene.fbprops.file_name:
        bpy.context.scene.fbprops.use_blendername = False
    else:
        bpy.context.scene.fbprops.use_blendername = True

### PROPERTIES  to store and update custom settings
class Filebrowser_Props(PropertyGroup):
  # blenderstart
    blend_path = bpy.context.blend_data.filepath  # loaded blendpath or empty if new
    if not blend_path:
        blend_path = "Untitled"
    blend_name = bpy.path.display_name(blend_path, has_ext=True)

  # testpanel
    def update_name(self,context):
        if self.use_blendername:
            self.file_name = self.blend_name   # blendername ('Untitled' if new)
    use_blendername: BoolProperty(default=False, description="Use Blendername", update=update_name)

  # custom settings
    file_path: StringProperty(default=blend_path)
    file_name: StringProperty(default=blend_name)
    file_format: EnumProperty(name="Format Select",
                          items=[
                           ('0', 'Blend', '.blend'),
                           ('1', 'FBX', 'fbx'),
                           ('2', 'glTF Binary',   'glTF Binary (.glb)'),
                           ('3', 'glTF Embedded', 'glTF Embedded (.gltf)'),
                           ('4', 'glTF Separate', 'glTF Separate (.gltf + .bin + textures),'),
                           ],
                          default='0',)
    file_formatlist = ['.blend', '.fbx', '.glb', '.gltf', '.gtlf']  # needed because .gltf two times
    use_formatchange: BoolProperty(default=True, description="Change fileformat to selected")
    use_filecheck: BoolProperty(default=True, description="Check and warn on overwriting existing files")

def register():
    bpy.utils.register_class(TESTPANEL_PT_Main)
    bpy.utils.register_class(Filebrowser_OT_export)
    bpy.utils.register_class(Filebrowser_Props)
    bpy.types.Scene.fbprops = PointerProperty(type=Filebrowser_Props)

def unregister():
    bpy.utils.unregister_class(Filebrowser_Props)
    bpy.utils.unregister_class(Filebrowser_OT_export)
    bpy.utils.unregister_class(TESTPANEL_PT_Main)
    bpy.types.Scene.fbprops

if __name__ == "__main__":
    register()
    check_names()  # for testpanel at start

Some additional notes:
In Operator we need an invoke() method to open and a draw() method to show custom properties in FileBrowser. User events in FileBrowser are catched by method check(). File export in execute(). PropertyGroup Filebrowser_Props to store the last user input. Custom properties are marked with underscore in the middle for difference (file_path, file_name). In TestPanel you can preselect file_name and use_filecheck (the red alert thing if file exists) with which the FileBrowser is opened.
If more export options are desired: all properties in File > Export > glTF 2.0 are included in ExportSceneOperator bpy.ops.export_scene.gltf. You find the correct attribute with mouseover - if Preferences > Interface > Display > Tooltips > User Tooltips and Python Tooltips are checked. Tested in 2.9.3 and 3.3.2

I think this is a bit more complicated than needed, but the essential thing is the check function inside the Filebrowser_OT_export class

Needed the same functionality and implemented it like this in Blender 3.6.4:

Set filename_ext to one of the extensions chosen by default.
Set filter_glob's default to a wildcard list of all extensions supported.
Add an EnumProperty filetype storing all extensions supported.
Handle draw to offer this property in the right sidebar.
Add a filetype_update callback to set the filename_ext.

import bpy
import bpy_extras

class CUSTOM_OT_ModelExport(bpy.types.Operator, bpy_extras.io_utils.ExportHelper):
    """Save a custom model file"""
    bl_idname = "export_scene.fbx_gltf"
    bl_label = "Export Custom Model"
    bl_options = {'UNDO'}
    filename_ext = ".fbx"
    filter_glob: bpy.props.StringProperty(default="*.fbx;*.gltf", options={'HIDDEN'})

    def filetype_update(self, context):
        CUSTOM_OT_ModelExport.filename_ext = "." + self.filetype.lower()

    filetype: bpy.props.EnumProperty(name="File Type", items=(
        ('FBX', "FBX", "", 1),
        ('GLTF', "glTF", "", 2),
    ), default='FBX', update=filetype_update)

    def draw(self, context):
        self.layout.prop(self, "filetype")

To dynamically change the filename_ext based on the value of the EnumProperty, you can move the code that sets the filename_ext from the draw function to the execute function. The execute function is called when the operator is actually executed, so this will ensure that the filename_ext is set correctly before the export occurs.
Here is an example of how you could modify your code to achieve this:
import bpy

def write_some_data(context, filepath, use_some_setting):
    print("running write_some_data...")
    f = open(filepath, 'w', encoding='utf-8')
    f.write("Hello World %s" % use_some_setting)
    f.close()

    return {'FINISHED'}

from bpy_extras.io_utils import ExportHelper
from bpy.props import StringProperty, BoolProperty, EnumProperty
from bpy.types import Operator

class ExportSomeData(Operator, ExportHelper):
    """This appears in the tooltip of the operator and in the generated docs"""
    bl_idname = "export_test.some_data"  # important since its how bpy.ops.import_test.some_data is constructed
    bl_label = "Export Some Data"

    # ExportHelper mixin class uses this
    filename_ext = ".gltf"

    filter_glob: StringProperty(
        default="*.txt",
        options={'HIDDEN'},
        maxlen=255,  # Max internal buffer length, longer would be clamped.
    )

    # List of operator properties, the attributes will be assigned
    # to the class instance from the operator settings before calling.
    use_setting: BoolProperty(
        name="Example Boolean",
        description="Example Tooltip",
        default=True,
    )

    type: EnumProperty(
        name="Example Enum",
        description="Choose between two items",
        items=(
            ('OPT_A', "First Option", "Description one"),
            ('OPT_B', "Second Option", "Description two"),
        ),
        default='OPT_A',
    )

    def draw(self, context):
        layout = self.layout
        layout.use_property_split = False
        layout.use_property_decorate = False  #No animation
        sfile = context.space_data
        operator = sfile.active_operator

        row = layout.row()
        row.prop(operator, 'type')

    def execute(self, context):
        if self.type == 'OPT_A':
            self.filename_ext = '.gltf'

        if self.type == 'OPT_B':
            self.filename_ext = '.fbx'
        return write_some_data(context, self.filepath, self.use_setting)

def menu_func_export(self, context):
    self.layout.operator(ExportSomeData.bl_idname, text="Text Export Operator")

def register():
    bpy.utils.register_class(ExportSomeData)
    bpy.types.TOPBAR_MT_file_export.append(menu_func_export)

def unregister():
    bpy.utils.unregister_class(ExportSomeData)

register()

When I run your code and then go to File > Export > Text Export Operator it still does not have the function I need.
My example already has the if statements in the execute function.
Should I try to elaborate more precisely what I need?


text:
Different EnumProperty design
How do I get this design of an EnumProperty?
My code(basically just the standard Operator File Export template):
import bpy

def write_some_data(context, filepath, use_some_setting):
    print("running write_some_data...")
    f = open(filepath, 'w', encoding='utf-8')
    f.write("Hello World %s" % use_some_setting)
    f.close()

    return {'FINISHED'}

# ExportHelper is a helper class, defines filename and
# invoke() function which calls the file selector.
from bpy_extras.io_utils import ExportHelper
from bpy.props import StringProperty, BoolProperty, EnumProperty
from bpy.types import Operator

class ExportSomeData(Operator, ExportHelper):
    """This appears in the tooltip of the operator and in the gener ated docs"""
    bl_idname = "export_test.some_data"  # important since its how  bpy.ops.import_test.some_data is constructed
    bl_label = "Export Some Data"

    # ExportHelper mixin class uses this
    filename_ext = ".txt"

    filter_glob: StringProperty(
        default="*.txt",
        options={'HIDDEN'},
        maxlen=255,  # Max internal buffer length, longer would be clamped.
    )

    # List of operator properties, the attributes will be assigned
    # to the class instance from the operator settings before calling.
    use_setting: BoolProperty(
        name="Example Boolean",
        description="Example Tooltip",
        default=True,
    )

    type: EnumProperty(
        name="Example Enum",
        description="Choose between two items",
        items=(
            ('OPT_A', "First Option", "Description one"),
            ('OPT_B', "Second Option", "Description two"),
        ),
        default='OPT_A',
    )

    def execute(self, context):
        return write_some_data(context, self.filepath, self.use_setting)

# Only needed if you want to add into a dynamic menu
def menu_func_export(self, context):
    self.layout.operator(ExportSomeData.bl_idname, text="Text Export Operator")

def register():
    bpy.utils.register_class(ExportSomeData)
    bpy.types.TOPBAR_MT_file_export.append(menu_func_export)

def unregister():
    bpy.utils.unregister_class(ExportSomeData)
    bpy.types.TOPBAR_MT_file_export.remove(menu_func_export)

if __name__ == "__main__":
    register()

    # test call
    bpy.ops.export_test.some_data('INVOKE_DEFAULT')

Just regular operator properties... There are tons of examples over here, eg: https://blender.stackexchange.com/a/31825/31447 Even the operator_file_export.py template comes with two example properties and how to implement them properly.

In Edit>Preferences>Interface turn on Developer Extras. Then you can right click on anything, hit Edit Source, and switch to the Text Editor to see the source code for what you clicked on. This is an EnumProperty with options={'ENUM_FLAG'}.

@brockmann the basic implementation is not the problem, I get that
It's rather this specific UI element

@scurest yes, it is this one and big thanks for the Developer Extras thing

ATM you're asking how to "Replicate the Export Window", recommend edit your question, especially your title and add the current state of your code in order to make this useful to future visitors, https://blender.stackexchange.com/help/how-to-ask @Lala_Ghost

You also need to add a draw method to your operator like this
    def draw(self, context):
        layout = self.layout
        layout.use_property_split = True
        layout.use_property_decorate = False  # No animation.

        # column() is what makes it go vertically
        layout.column().prop(self, "type")

By editing the line 48, replacing the "default='OPT_A'," with "options={'ENUM_FLAG'}," you almost get the desired result only the orientation is not correct.
import bpy

def write_some_data(context, filepath, use_some_setting):
    print("running write_some_data...")
    f = open(filepath, 'w', encoding='utf-8')
    f.write("Hello World %s" % use_some_setting)
    f.close()

    return {'FINISHED'}

# ExportHelper is a helper class, defines filename and
# invoke() function which calls the file selector.
from bpy_extras.io_utils import ExportHelper
from bpy.props import StringProperty, BoolProperty, EnumProperty
from bpy.types import Operator

class ExportSomeData(Operator, ExportHelper):
    """This appears in the tooltip of the operator and in the generated docs"""
    bl_idname = "export_test.some_data"  # important since its how  bpy.ops.import_test.some_data is constructed
    bl_label = "Export Some Data"

    # ExportHelper mixin class uses this
    filename_ext = ".txt"

    filter_glob: StringProperty(
        default="*.txt",
        options={'HIDDEN'},
        maxlen=255,  # Max internal buffer length, longer would be clamped.
    )

    # List of operator properties, the attributes will be assigned
    # to the class instance from the operator settings before calling.
    use_setting: BoolProperty(
        name="Example Boolean",
        description="Example Tooltip",
        default=True,
    )

    type: EnumProperty(
        name="Example Enum",
        description="Choose between two items",
        items=(
            ('OPT_A', "First Option", "Description one"),
            ('OPT_B', "Second Option", "Description two"),),
        options={'ENUM_FLAG'},
    )

    def execute(self, context):
        return write_some_data(context, self.filepath, self.use_setting)

# Only needed if you want to add into a dynamic menu
def menu_func_export(self, context):
    self.layout.operator(ExportSomeData.bl_idname, text="Text Export Operator")

def register():
    bpy.utils.register_class(ExportSomeData)
    bpy.types.TOPBAR_MT_file_export.append(menu_func_export)

def unregister():
    bpy.utils.unregister_class(ExportSomeData)
    bpy.types.TOPBAR_MT_file_export.remove(menu_func_export)

if __name__ == "__main__":
    register()
    bpy.ops.export_test.some_data('INVOKE_DEFAULT')


text:
UV Unwraping to cover the full image
I have a mesh that represents a piece of paper. This mesh can be unwrapped to a rectangle surface. When I select all faces and then unwrap to get the UV. I obtain the following :

The problem is that the UVMap does not cover the full rectangle image. How can I make the UVMap automatically distort in a way that it covers the full image?
Additional question, how can I do that using the Python scripting API?
Thank you very much for you help!
Edit : If I disable the Correct Aspect option I get the following result, which is even worse

When you unwrap, what does it give if you disable the Correct Aspect option in the Operator Box?

I added an edit to the original post. If I disable the Correct Aspect option in the Operator Box it gets worse ...

Could you please pack your image (File > External Data > Pack Resources) and share your file (this object only)?

Sure here is a link to the file
https://drive.google.com/file/d/1liaqbAXiy2mDay1ZNKHVk0-eeww-sOzV/view?usp=sharing

there may be a simple function but I don't know it, you can do it manually but it's a bit tedious (UV > Constrain to Image Bounds, choose the 2D Cursor as pivot, put the 2D cursor at 0:0, scale your UV island on X and Y)

I could not find any function to achieve what I wanted automatically, so I wrote a small script that does that. Here it is (works with Blender 3.5.1):
import bpy
import numpy as np

obj = bpy.context.active_object
# Apply the linear unwrap, to make the UVMap fit the [0, 1] range

# First find the min and max UV coordinates
max_u, min_u = -np.inf, np.inf
max_v, min_v = -np.inf, np.inf

for face in obj.data.polygons:
    for loop_idx in face.loop_indices:
        uv_coords = obj.data.uv_layers.active.data[loop_idx].uv
        if uv_coords.x > max_u:
            max_u = uv_coords.x
        if uv_coords.x < min_u:
            min_u = uv_coords.x
        if uv_coords.y > max_v:
            max_v = uv_coords.y
        if uv_coords.y < min_v:
            min_v = uv_coords.y

# Fit a linear function to the UV coordinates
def fit_linear(x0, y0, x1, y1):
    a = (y1 - y0) / (x1 - x0)
    b = y0 - a * x0
    return a, b

margin = 0.0001  # Margin to leave between the UV coordinates and the [0, 1] range

a_u, b_u = fit_linear(min_u, 0 + margin, max_u, 1 - margin)
a_v, b_v = fit_linear(min_v, 0 + margin, max_v, 1 - margin)

# Apply the linear function to the UV coordinates
for face in obj.data.polygons:
    for loop_idx in face.loop_indices:
        uv_coords = obj.data.uv_layers.active.data[loop_idx].uv
        uv_coords.x = a_u * uv_coords.x + b_u
        uv_coords.y = a_v * uv_coords.y + b_v

This piece of code basically takes the current UVMapping and stretches to the  [0, 1] range in both directions, thus covering the entire image.
Here is an example of a result:

Before applying the script, the UVMap does not cover the full image.

After applying the script, the UVMap covers the full image.
So in the end the script is a sort of equivalent of the Scale to Bounds option of the cube projection UVMapping.

wow nice!..........

Use Cube projection for unwrapping and select the Scale to Bounds option.Cube projection. (As far as I understand) Cube Projection projects the geometry on faces of a cube and creates a uv map based on these faces. Now since cube projection does have an option  to scale to bounds, what will happen is that. your UV map is scaled to fit perfectly within the UV 0-1 space.

The problem is that, as can be seen in my first image, the original paper is not flat, it's a curved piece of paper, so this will not work.
Thanks anyway


text:
I've got my geo nodes set to give random rotation to points, but it's not working
I'm working on the donut tutorial, and got stuck in video 12 where you make the floating particles, managed to do everything correctly until the part where you make them rotate independently.
I did everything as shown in the video as you can see in the following image:

but it isn't working, the particles aren't rotating.
this is my blender file:

The reason your #frame driver wasn't actually returning the current frame, was that it was being put through an f-curve.  (If you right-click  >  open up a Drivers Editor  with the node selected, you can see it.) Unlike animation f-curves, which are time along the X axis and value along Y, Driver f-curves are expression value along X, and you own mapping of it along Y. Best way out: forget it, and use Scene Time , as Gordon has suggested.

I don't know what you've done to your particles... I see almost only spheres - and rotation is hard to see on spheres.
I created a new collection with cylinders to see the movement better. Turns out, your rotation setup does work, but very very slow. I've set the Math > Divide node to divide by 0.1 see at least some movement.
As it turns out, the #frame driver used for the animation is no longer working as expected, it is not putting out the frame number as value (as you can see in your screenshot, the current value is 0.916). The tutorial is using an older version of Blender.
Today you can use the Frame output of the Scene Time node to get the frame number.

Can you show which divide node you changed?

@ThunderCoder The one to the right of the screenshot, the one for the random rotation, but I changed it back because as I explained in my answer, if you use the Frame output of the Scene Time node this is not necessary. The driver #frame does not work properly anymore, in your file it decreases slowly from 1.0 to some small value < 1.

-tau to tau is a pretty silly range for random rotation, but maths was never a big thing in Andrew Price's toots, I guess :D

@RobinBetts Definitely not  But anyway, that wasn't the problem here...


text:
How can I project 3D objects with the Instance on Points node perpendicular to an adjacent line?
The last few week I worked on developing a Geometry Node workflow. This Geometry Node workflow's main goal is to speed up a Digital Twin's modeling process. This product is part of a larger research project. As a student, I am currently working on thesis research about the development of Digital Twins. This study aims to discover new workflows that could significantly improve the level of detail and location recognition inside the current Digital Twin. The findings and new research results will be shared in a publication and presentation. This thesis will be the final project to complete my higher vocational education in Architecture and Construction Engineering.
Objective
I hope to achieve a workflow that makes it possible to project 3D objects on 2D points. The orientation of the 3D object should be perpendicular to the adjacent line. To clarify the use case of this workflow I will further explain the scope of my thesis research. In the Netherlands, it is possible to receive large datasets from urban areas. These datasets contain vector or raster data of the buildings, landscape and infrastructure. Besides the 2D geometry, lots of these datasets also contain valuable metadata. The 2D geometry consists of polylines, lines and points. I am developing a workflow that will convert the 2D points of streetlights into 3D objects.
The prototypes of this workflow contain a line and some random points. The line illustrates the center of the road. The 2D points are the basepoints of the 3D objects. An important precondition is that the lighting from the streetlights cover the road. To meet this objective, I want to integrate mathematical tools in my geometry nodes workflow. Mathematical insights make clear that the shortest distance from a point to a line is always the perpendicular projection. For every random point, I want to retrieve the perpendicular projection between the point and line. In the next step I will align the light bulb form the streetlight to this normal vector.
Issues
During my variant study I discovered the following nodes:

Align Euler to Vector
Sample Nearest
Capture Atrribute
These nodes were used to retrieve the perpendicular projection of the points and line. I tried to integrate these nodes with the Instance on Points nodes. Unfortunately, I discovered that every streetlight gets the same rotation. In my current workflow I tried to retrieve the normal vector of the line via an object info node. In the following steps this geometry gets translated to vector data.

Desired solution and workflow
In my desired workflow I want to control the position of every individual streetlight. In the following iteration, I want to align the light bulb of the object perpendicular to a line. Every streetlight has another normal vector because the shortest distances between the line and points vary. My intuition says that the order of the nodes needs to get adjusted. This has already been confirmed when connecting two Align Euler to Vector nodes in a row. The second Align Euler to Vector nodes determines the rotation in the Instance on Points node.
Since I have worked with Revit and Dynamo I am used to integrating a watch node in my scripts. In Dynamo this Watch node reviews the outcomes of a chain of nodes and operations. Is it possible to integrate a similar node inside the Geometry Nodes of Blender?
Examples
My variant study and current findings are displayed below.

GN script with rotate euler node as manually correction button of rotation

GN script with combination of two align euler to vector nodes in a row

Second option; integrating a capture attribute node

Third option; integrating a sample nearest node

Sketch of the desired solution; light bulb of streetlight perpendicular to line of road
I would highly appreciate your input on my thesis research and look forward to hearing from you at your earliest convenience.
Kind regards,

In your sketch of the desired solution it looke like the street lamps are lying on the floor, is this really what you want to achieve? If not, could you maybe make a manual 3D model of the situation you want to achieve automatically? Also "light bulb of streetlight perpendicular to line of road" - I don't see that. Maybe the 2nd from the bottom, but the others surely not. If you've used a software like Excalidraw to draw vectors and display clearly the right angles, it would be some starting point for discussion. All in all, very lengthy question, and not a lot of meat :P

@YosriSem In img no. 5&6 why are you using  the object a for sampling or capturing? It's the points of the line mesh that you have to calculate the normal of not the streetlight.

You have to subtract the position of the current point from the nearest point of the street curve to get the shortest vector from the instantiation point to the street curve.
If the original street light points into x-direction, you can then use Align Euler to Vector with X and this calculated vector as parameters, to define the rotation of each street light.


text:
How to align object on normal vector between vertex and line
Update 29-08-2023 22:20
Dear community,
Thank you for the input! The responses gave me some useful tips and nodes to integrate in the desired workflow. Since not everything was clear, I will give some more context about the project.
I am working on an urban Digital Twin. On this project I am focussing on adding more detail to city by converting 2D points to 3D objects. The government of the Netherlands provides us with open datasets. This open datasets contain for example the position and measurements of street signs and streetlights.
By using QGIS I can retrieve the center axis of a road. The streetlights should light up the road. Therefore, I want to align the lights perpendicular to the center axis of the road. In my test project the road is a simple line. The points are just references to place the object on the correct x and y coordinate. The desired iterations on the project are as following:

Modelling streetlights with geometry nodes perpendicular to the street.
Modelling street signs with geometry nodes parallel to the street.

The question in both situations is how can the rotation of instances be based on nearest lines. The 2D points are just reference points from a dataset which tell the position. This position does not contain any information about the orientation of the object.
At the moment I am working on a Geometry Nodes setup to place 3D geometry on some random points. The 3D geometry contains a street light. The light bulb of the street light should be orientated to the line. In other words the street light is perpendicular to the line of the road. I am using the Instances on Points node and hope to achieve my goal by retrieving a normal vector.
This normal vector should illustrate the shortest distances between the line and the vertex. I can retrieve the normal of the line and a normal of the vertex. For my usecase I think I need to capture the normal of the line. I tried a combination of the Capture Attribute node and the Align Euler to Vector node. Are there anymore options left? Perhaps the Raycast node?
Questions and desired solution
In short are my questions as following:

How can I retrieve the shortest distance between a line and a vertex with a node with Geometry Nodes?
How can I align an object with the orientation of the shortest distance vector?

I hope to achieve a method in which the light bulb (the source object is orientated to the positive x-axis) get automatically aligned with the shortest distance between a line and a vertex.
Examples

Orientation of source object

Random points on the right side of the line

Current workflow geometry nodes

Desired solution; the blue lines illustrate the normal vector and the rotation of the street light.
I would highly appreciate your input on my research and look forward to hearing from you at your earliest convenience.
Kind regards,

Let me make sure I understand, because it's kind of weird for streetlights:

Here, we have a line that's been given a skin modifier for visibility, and cuboids that are aligned with the normal of that line-- with the nearest point on that line.  This would be a weird thing to do with streetlights, because then they'd slant on hills.  So I want to make sure that's what you want.
If that's what you want, yup, a line from any point to the nearest point on another line will be perpendicular to that second line.  So long as that second line is infinitely long.
But unfortunately, GN does not support sampling "nearest edge interpolated".  At least, not at this time.  We can sample the nearest point-type entity, we can sample a surface, we can raytrace (which will almost never intersect our line thanks to precision problems) but we can't directly sample nearest edge interpolated.  Which is a problem for the cases where our instances don't bear any relationship to the line we want to sample.
Using GN, if we're willing to accept some tiny imprecision, we can point instances at close to the nearest point on that line:

I'm showing a copy of our line with a skin modifier still, but it's just to display the line; it's not used by the GN.  The geometry nodes are turning that line into a very, very thin cylinder so that we can sample the nearest surface position; then I'm using "align Euler to vector" to rotate our instances, about their Y axes, to point their Z axis in the same direction as the vector from the line to the instance.
Notice that the monkeys are parallel up until the line ends-- after that, they point at the end of the line.

I'm assuming that you have separate objects for the street signs and the street lights as a starting point here (At least that could probably be easily separated as well, if not).
In this case, and to keep the Geometry Nodes node group flexible to use, I suggest the following setup:

Since you mention in your example that you are dealing with real data, I have to assume that neither the points of the road nor the points at which the objects are to be instantiated are on a plane.
Therefore, since streetlights and signs are usually upright (hopefully this is also the case in the Netherlands), you would have to do the calculation of the direction vector on a plane, or discard the Z positions in the process.
In this example I created a reusable node group that you can use on all objects consisting of points where street signs or lanterns should be positioned.
You just have to define here the object that contains the mesh of the street line, the object that should be instantiated and additionally you have the possibility to influence the local rotation of the objects.
What I do here:

First I discard the Z-positions of the street line
Then I extrude it upwards, because you probably don't want to get the closest point or the center of the closest edge, but any closest point on the face of the object
So it is now possible to get the actual nearest point on the upward extruded mesh line with the help of the node 'Sample Nearest Surface'. But since the points at which the objects are to be instantiated are also at different Z-positions, I also use the positions of the points with discarded Z-axes as Sample Position.
After that this vector only has to be converted into a rotation with the help of 'Align Euler to Vector', and if necessary the rotation has to be corrected according to the orientation of the object.
Finally, the objects are instantiated at the desired points, with the previously calculated rotation.

You can then apply this node group as often as you like to any objects.
(Blender 3.6+)

Dear Blender professional (since I can't see your username because of the edits by quellenform), Thank you for your input and detailed step by step plan. I will look further into the script this weekend. Have a nice weekend!

@YosriSem Don't worry, take the time you need and get back to me if you have any questions. Btw: I am quellenform and I created and edited this post ;-)

Dear @quellenform, The past months I have been experimenting with the script. There are occurring some problems when I insert a shapefile with a roadmap of a town. But I think I can fix them if I know every function of the nodes in the script.

@YosriSem ...Let me know if you need help ...there is a solution for (almost) everything. ;-)

After using and experimenting with the script I do have some questions. At the moment I am experiencing some minor problems with inserting a shapefile, in which a collection of roads is saved. I am convinced I can solve these problems if I understand the function of every node. Could you answer the following questions or explain in depth the function of some nodes. 1. What is the function of the extrude node group? 2. Why is z vector being used in the get direction node group? 3. What are the pros of using the group input node instead of the object info node?

Comments have been moved to chat; please do not continue the discussion here. Before posting a comment below this one, please review the purposes of comments. Comments that do not request clarification or suggest improvements usually belong as an answer, on [meta], or in [chat]. Comments continuing discussion may be removed.

unfortunately I can't recover the Blender chat with the valuable answers and tips of you. In the shared file 20231107_3D-model_Deelgebied-2_YSK-mod.blend the GN have been based on meshes as reference. Unfortunately, some polygons intersect with the points of the lights. Is it possible to rotate with 180 degrees if the instances on the points intersect with the polygons? I tried to follow the shared workflow in this thread https://blender.stackexchange.com/questions/265968/geometry-nodes-mesh-intersection-line-procedural-weld

@YosriSem Here is the chat: https://chat.stackexchange.com/rooms/149480/discussion-on-answer-by-quellenform-how-to-align-object-on-normal-vector-between
Can you share a blend file with a concrete example? ...I don't understand exactly what you mean right now.

Thank you for the fast reply! I started a new post where I hopefully give enough context. I tried already using the same link, which leads me to a broken link. Could you send me screenshots of the chat? I hope to learn more and look up the lessons in the future.