Copy and Orient Block to Object

Hi guys, if the red geometry is a linked block and the black geometry is the same geometry (barring orientation and position) but not a block, is it possible to copy red to black so that red is positioned and oriented as black?

Thanks
H

Hello - Orient3Pt should do it.

-Pascal

Hi Pascal, thanks for your speedy reply. I was hoping for something a bit more magical (ie quicker) like @Helvetosaur 's CopyObjectToPts script.

KR
H

Hello - wouldn’t ExplodeBlock on each of the orange blocks accomplish that?

-Pascal

I think there is, but it will require some testing and probably only works for the parts it is designed for.
Not sure if it will work but this would be my logic:

Take the black items per group and see it is possible to find unique elements that you can use for orientation,( for example an edge that is 12.6473mm long) and then find those edges in the block and use these for matching.

Hi Pascal, unfortunately the orange aren’t blocks, the black are. I’m trying to replace the orange with black. KR. H

I made a script for this for breps but I do not see how to make it work for blocks… I need to ponder…

-Pascal

Thanks for looking into it Pascal. You guys rock!

I’m doing it manually at the moment and 1/3 way through. Luckily, they are all on the same plane so simple rotation is working fine. When you figure it out, please do share in the event I (and others) need it in the future.

BW
H

=)

@hayden - are the block objects meshes or polysurfaces ( the chairs)?

Well, tons could go wrong here but if there is one brep or one mesh in the block and the targets are all copies of the same brep as in the block, there is a chance this will work.
I’d say in general the chances are small but it may be worth a try.

ReplaceWithBlocked.py (2.7 KB)
To use the Python script use RunPythonScript, or a macro:

_-RunPythonScript "Full path to py file inside double-quotes"

@hayden - it is still very iffy but I replaced the script with a new one that may be somewhat more robust - it tries to take into account blocks with more than one object. If the base block has more than one object then you are prompted the pick the one you care about and then one by one, the objects that you want to replace with that object when the block is added.

eg, if you have a block with a box and a sphere, and a bunch of exploded versions of that here and there, you pick either the box or the sphere from the block objects and then one by one all the targets, either box or sphere according to what you designated in the block. I’m not sure how much more can be done - it could be made to support other object types - currently the objects selected must be breps or meshes, but I don’t know if the whole thing is robust enough to mess with any more.

-Pascal

2 Likes

Hi @pascal - you are a god!!!

So I played around with the first script you sent and realised it only worked when the block consists of a single object. Very useful and definitely a keeper! See result below:

As I was about to report back you beat me to it and posted your little treat. Absolute PERFECTION!

PS: For others who use this, make sure to choose an object from the base block which is only a single object on its own layer (eg the cushion and not the legs in my case).

Thanks again Pascal!

H

Oh! Well, good deal. I’m shocked that it actually works in real life - it is very fragile and will only help under very specific circumstances, and probably make a mess in others, but I guess that is better than nothing…

-Pascal