Correcting the orientation of 3D models

I remembered where I saw it. It’s still there. In kicadStepUp-cheat-sheet.pdf you see:

and

For now, I’m using KiCadStepUp only to save my FreeCAD models to files for KiCad and to position the 3D models found on the web.
But in order not to hinder a wider use of KiCadStepUp in the future, I adhere to these requirements, even if I do not know what they result from.

This is not because of some “bug” that rotation or scaling does not work. It is more a “good practice”, that when using 3D models, the model itself should be constructed in such a way that additional scaling or translation should not be needed. This is even officially specified in the KLC

The 3D models must be aligned and scaled appropriately to match the associated footprint.

When dealing with 3D models from external sources, it is not realistic to expect them to conform to the KLC, and for those models there is an option to rotate and translate them in KiCad.

3 Likes

That doesn’t fit the word ‘mandatory’ used there.

Also doesn’t fit to “rotate (xyz 0 0 z_value)” what allows one parameter being not 0.

The texts from StepUp-cheat-sheet do not seem to me to describe only good practices. They clearly suggest to me that perhaps an operation in StepUp that I have never used has some problems when the 3D model position is modified. Maybe the author simply knows that in one or two transformations he ignored coming from KiCad parameters for modifying the model position.

You’re overthinking it.

I had not seen that document before, but found a copy on:

My first question would be: What is the origin of that document? Who wrote it, and what is their relation to KiCad?

But such questions are not very important.
I remember an old KiCad version where offsets and rotations were added to 3D models in the default libraries, and making it “mandatory” to clean this up brought some order in the chaos.

If that is so, then it is a bug and that bug should be fixed.

I do recall a vague memory. I think part of step files is that rotation of an object can be defined in the step file itself. So there is a difference between rotating a 3D object in the step file, or defining a rotation in the step file without rotating the object itself. And this is yet another set of coordinates compared to the rotation / translation of the 3D model upon import. And a 4-th level of rotation is added while positioning the footprint itself on the PCB.

But to me it’s just “good practice” to define objects in files as they are. When you start adding different rotations and translations on top of each other you just create more room for errors to creep in and confusion.

1 Like

AFAIK the origin of that document is from @maui. He is the developer of the KiCadStepUp plugin for FreeCAD. AFAIR his relation to KiCad is he is a user like you and me. I don’t think he is a KiCad developer, nor a librarian.

As for the why in the footprint the scaling should be all 1s and rotations and scalings should be set to all 0s is probably because that is what StepUp expects. But @maui is the one that should give the definitive reason for why. (Which is why I’ve invoked him.) :wink:

Please note that all (most) of the KiCAD 3D libraries are based on FreeCAD scripts that I started as my own 3D library.

that was the resulting repository
https://github.com/easyw/kicad-3d-models-in-freecad/FCAD_script_generator
then moved to gitlab

and here at KiCAD the mention to be a contributor (with all the other contributors to the original 3d libraries)

StepUp allows all the offset and rotation, but it is not suggested to use it in a 3D library.

.

exactly that… 3d libraries were based only on vrml models (kicad was not able to read STEP format) These vrml models (useless for mechanical integration) were added with positions completely arbitrary and even some of them scaled (what should completely avoided in a mechanical environment).
Then the librarian agreed in writing a KiCAD Library Conventions following the above rules.

I think the source of uncertainty is the use of the word mandatory in a cheat sheet. English is not my primary language and I can understand something wrongly, For me if something is only not suggested to be used you can’t tell that it is mandatory to set it to 0.

If someone tries to tell me something is “mandatory”, I go though some unwritten checklist, and first make an estimation whether I trust that person and his judgement, and also whether that person is of importance to me.

If you met a stranger on the street, and he told you it is mandatory that you give your wallet to him, would you do it, laugh at him, or just shrug your shoulders and ignore him?

I am not sure this is as big an issue as in the past, however I use KicadSteupUp exclusively to orient parts to footprints so the Kicad Scale is at all 1.0, Rotation at all 0 an Offset at all 0. This is to guarantee if I hand off the board to another MCAD to pull it into a bigger assembly, everything still looks correct.

Using StepUp:

  1. The wrl and step always match
  2. The scaling is always correct
  3. I don’t have to worry about an MCAD not reading the scale/rotation/offset wrong
  4. Once you use StepUp a couple of times, the workflow is faster than the Kicad dialog (auto-center, set on Z-plane, import of vendor STEP, etc.)

My 2 cents…

2 Likes

This is aimed to library contribution, then I should even not allow z rotation.
Moreover if you import the footprint in FreeCAD to align the 3D model to the footprint itself, you must have x,y,z offset to zero and at least x,y rotation to zero.
So mandatory is the correct word for the use of my tool.

this one is hilarious… ok, I will give your money back because you are not satisfied by the instruction to use my tool…
oh, I forget, the tool is free to download and use… so no money back :rofl:

2 Likes

I think the point is that models come from a variety of sources and some may need adjustment, for instance rotation or translation, before they will match the real component. There is no official standardisation for model design so this is entirely to be expected. @maui StepUp plug in is the easiest way to adjust the model to fit (and does a lot more besides).
The situation is different for official KiCad 3d models included in the library. These must fit the footprint with no rotation/translation/scaling involved and this is defined in the KiCad library convention. So, if you want your 3d model to be included in the official library, it is mandatory that it complies with the scaling and placement requirements.

As related to this topic (of Origin’s with respect to Electronic parts used in Kicad and elsewhere):

You don’t care but, Once upon a time I worked for two ‘Connector’ Companies, I was Director of Engineering for a division of JAE and a Senior Design/Development Engr/Mgr for AMP. Thus, many engineer’s designs came to my desk and I taught CAD to engineers. My comments below stem from that work and working with these clients: Ford, BMW, Volvo, Visteon, Delphi, Delco, Molex, Lemo, Takata, Dyonix, Wolf, Storz and many more companies. And, my own Patents/designs.

There are NO rules, laws, Industry Standards, etc about how to Model parts or where to place Origins. The choice of Origin placement is made based on Personal Preference, Anticipation of Future Design Changes, aspects that make modeling easier or more difficult, software being used, the original intended usage of the part… There are Drafting/Drawing standards but, no Modeling standards.

Take a look at several of the STEP files that come with Kicad (example screenshots below show Origin’s in different locations… I opened them in FreeCAD) Origins are difficult to see so, I drew Yellow ring around them…

Does anyone really think that an engineer sitting at his/her desk is thinking about what Kicad, Altium, Fritzing, Fusion, and the host of others need for Origin?

The parts shown are:
Molex 55560_0601
Molex_AE_6410_09A
CUK_JS202011CQN DPDT
SW_DIP_SPSTx03_Piano
Fusion032_sp

I do not care about 3d models origin either. I make my models the easiest way I can find.

Then I match my model with its footprint with Kicad-StepUp.

This workflow is perfect to my needs.

1 Like

but in KiCAD 3d viewer you can align your model to the footprint only in a approximate way… your alignment is only based on visual feedback; you cannot measure anything in 3D, nor place a model in the center of anything or even a pin in the center of a pad.
The best way is act in a mechanical environment… that is why StepUp was created.

a few models do have sensible origins based on their geometry, just somewhere else and the offsets match some drawing value.
You’re absolutely right, actually measuring to verify is key, I omitted that when I wanted to point out that using something else than (1 1 1)(0 0 0)(0 0 0) didn’t produce any errors for some time for me. I have to use SolidWorks anyway, so I’ll usually just use that to find the origin and measure the offset values.

Do having these parameters set to 0 are only important to meet the requirements of the KiCad library?
If yes than everything is clear. No more questions.

This looks for me as separate subject. Not related to libraries. It is separate as for libraries z rotation also have to be 0 but in this subject not. I am not interested in the subject of KiCad library defined needs but only in this one (allowing z rotation to not be 0).
To tell you the truth I don’t understand this sentence (but have in mind that I have 0 experience with 3D CAD).
You write that I have these parameters set to 0 when I import the model to FreeCAD. But I import the model not coming from KiCad but for example from real part manufacturer page. The model has nothing common with KiCad yet so it can’t have KiCad defined offset and rotation parameters. These parameters simply don’t exists yet. I use FreeCAD + StepUp to position that model to allow me later when using this model in KiCad to set KiCad offset and rotation parameters to zeros.
I understand having these zeros as a goal that I want to achieve and you write as if it were a condition without which using FreeCAD to align the model is impossible. I don’t know what you have in mind. I feel that I don’t understand something. And why in this sense you exclude z rotation from being required to be 0. What special is in z rotation. If x,y rotations are wrong than model is wrongly aligned to footprint, but if z rotation is wrong the model is also wrongly aligned.

I can imagine using StepUp to move model to such position that in KiCad to have it correctly aligned to footprint I will have to set offsets other than 0. So I don’t feel having them 0 to be mandatory to use StepUp. I all the time assume that having them being 0 is mandatory because if not zero I will fall into some wrong consequences I just don’t know them.
Because you allow for z rotation and write that for library z rotation should not be allowed it means for me that these wrong consequences are something different than simply a failure to meet library requirements.
I believe that what I wrote allows you to catch what I understand differently.

  1. you need to understand the StepUp workflow, to understand its instructions.
  2. in StepUp you can import a kicad footprint inside the 3d mechanical environment.
  3. after having the fp inside FC, then you import your model to the same document.
  4. here you can measure the distance of the 3d object from the 3d model of the footprint. Then you could take note of these values to assign those in your fp or (as kSU approach) move the 3d object to match the footprint placement and export the 3d model with this placement. This option will then force your footprint to have all the placement values to 0.
  5. the rotation on z plane is related to the footprint design; kicad libraries have some convention but each user may have a different convention in design his/her footprint (i.e. pin 1 at top or at left etc). Then the need to leave this option (orientation on z plane) free.

Hoping this has solved your doubs in why I wrote those notes on kSU instructions.

Thank you for trying to clear up my doubts. I understand (I think perfectly) points 1,2,3,4.
With 5 I have still lot of doubts. I understand it that way: The 3D model in KiCad official library will have all placement values 0, but the user who will define his own footprint 90° rotated is expected to use the same 3D model giving it z rotation. Assuming he will do it you call as leaving this one parameter free.
My (long list of) questions:
What that really means that this one parameter (and only this one) is free?
Telling that this one is free suggests that others are not free. So users (using external source 3D models) should not use them.
Why they should not use them?
If they use them then they are doing against what?
What threatens them when they use all the parameters?
Do this restriction should be fulfilled always or only in some circumstances? What circumstances?
Is this restriction connected only with publishing someones footprint with his 3D model, or he should not use these parameters even he is using the model only for his own purposes?
In your cheat sheet it is written as if these requirements were always in force (they are mandatory).

At the beginning of this thread there was suggestion to freely use all positioning parameters.
And I spoke out against it because I remembered (from your cheat sheet) that it is mandatory that all parameters (except rotation z) should not be used.
I just would like to understand how strong this mandatory is. Until this thread I understood it that if I use them I can get into some problems in the future (may be when I will be trying to use 3D model of my whole PCB someway).
Now I do not know what will happen to me if I do not follow the mandatory of not using other then z rotation parameters in KiCad. Is it danger in any way or not? If not then why you call it mandatory?

Aren’t you overthinking this? If something works for you, it works.

It makes sense in context of KiCad to use model which doesn’t need any movement or rotation, and if you use StepUp, why not just make the model according to that convention?

You make it sound like you would be thrown into Gehenna or something like that. The worst that could happen is that you need a board 3D model with part models later for something which you don’t know yet, and something (a 3rd party exporter/importer?) doesn’t understand the movements and rotations in the KiCad file and the part models are placed wrong. In case it happens – which is improbable – can’t you just fix them then?

The main reason is that I like to understand tools I am using.

And I do it that way since 2017 when started to use KiCad. I didn’t tried to overthinking this until this thread. Seeing suggestion to use all those parameters positioning 3D model I protested as I remembered that mandatory is not to use them.
Now I am trying to find “was I the protesting right”.

If it would be 3rd party software I would don’t care as I don’t plan to use it. I expected (I was pretty sure) that may be some functions in StepUp ignores these parameters as it is in StepUp cheat sheet where I have read that not using them is mandatory.
StepUp has dozens functions from which I learned to use 4 or 5 only, but expect to use more in future.

When I saw the suggestion to use all of this positioning parameters I assumed that this can lead to some problems in unknown by me yet StepUp functions so may be it is wrong suggestion. When I see here wrong suggestion I am trying to at least point it.
My problem this time is I still don’t know if that is good suggestion or not.
I decided to have all these parameters set to 0 but I had to learn to use FreeCAD and StepUp what took me significant time.
If not using these parameters are practically not mandatory then it looks I lost time on learning how to not use them.
The problem is - what is the right suggestion to OP:

  1. To freely use these parameters
  2. To learn how to modify a model to not use them.