FreeCAD Logo FreeCAD 1.0
  • angielski afrykanerski arabski białoruski kataloński czeski niemiecki grecki hiszpański hiszpański baskijski fiński filipiński francuski galicyjski chorwacki węgierski Indonezyjski włoski japoński kabylski koreański litewski duński Norweski Bokmal polski portugalski portugalski rumuński rosyjski słowacki słoweński serbski szwedzki turecki ukraiński walenciański wietnamski chiński chiński
  • Funkcjonalność programu
  • Pobierz
  • Blog
  • Dokumentacja
    Spis dokumentacji Jak zacząć Dokumentacja użytkowników Podręcznik do programu FreeCAD Dokumentacja środowisk pracy Dokumentacja skryptów środowiska Python Dokumentacja kodowania C++ Poradniki Najczęściej zadawane pytania Polityka prywatności O FreeCAD
  • Przyłącz się do projektu
    Jak pomóc Sponsor Zgłoś błąd Utwórz pull request Praca i finansowanie Zasady współpracy Podręcznik dla programistów Tłumaczenia
  • Społeczność
    Kodeks postępowania Forum The FPA GitHub GitLab Codeberg Mastodon Matrix IRC IRC via Webchat Gitter Discord Reddit Twitter Facebook LinkedIn Kalendarz
  • ♥ Donate

Donate

$
Informacje o SEPA
Skonfiguruj przelew bankowy SEPA do:
Beneficiary: The FreeCAD project association
IBAN: BE04 0019 2896 4531
BIC/SWIFT: GEBABEBBXXX
Bank: BNP Paribas Fortis
Adres: Rue de la Station 64, 1360 Perwez, Belgium

While Stripe doesn't support monthly donations, you can still become a sponsor! Simply make a one-time donation equivalent to 12 months of support, and you'll gain access to the corresponding sponsoring tier. It's an easy and flexible way to contribute.

If you are not sure or not able to commit to a regular donation, but still want to help the project, you can do a one-time donation, of any amount.

Choose freely the amount you wish to donate one time only.

You can support FreeCAD by sponsoring it as an individual or organization through various platforms. Sponsorship provides a steady income for developers, allowing the FPA to plan ahead and enabling greater investment in FreeCAD. To encourage sponsorship, we offer different tiers, and unless you choose to remain anonymous, your name or company logo will be featured on our website accordingly.

from 1 USD / 1 EUR per month. You will not have your name displayed here, but you will have helped the project a lot anyway. Together, normal sponsors maintain the project on its feet as much as the bigger sponsors.

from 25 USD / 25 EUR per month. Your name or company name is displayed on this page.

from 100 USD / 100 EUR per month. Your name or company name is displayed on this page, with a link to your website, and a one-line description text.

from 200 USD / 200 EUR per month. Your name or company name and logo displayed on this page, with a link to your website and a custom description text. Companies that have helped FreeCAD early on also appear under Gold sponsors.

Instead of donating each month, you might find it more comfortable to make a one-time donation that, when divided by twelve, would give you right to enter a sponsoring tier. Don't hesitate to do so!

Choose freely the amount you wish to donate each month.

Please inform your forum name or twitter handle as a notein your transfer, or reach to us, so we can give you proper credits!

PlacementAbsolufy

Description
This macro resets position of all part containers to document origin while keeping the absolute object positions.

This macro has been written mainly to circumvent unfinished Part container implementation that can lead to absolute position shift, mainly when exporting parts. This is due to fact that Part containers creates a local coordinate system that can be shifted from global one. This local referential is then used by subsequent objects but isn't correctly handled by several functions (eg. export).

Macro version: 0.2
Last modified: 2019-06-10
FreeCAD version: 0.17+
Download: ToolBar Icon
Author: OpenBrain

Author
OpenBrain
Download
ToolBar Icon
Links
Macros recipes
How to install macros
How to customize toolbars
Macro Version
0.2
Date last modified
2019-06-10
FreeCAD Version(s)
0.17+
Default shortcut
None
See also
Macro StraightenObject

Description

Context

This macro has been written mainly to circumvent unfinished Part container implementation that can lead to absolute position shift, mainly when exporting parts. This is due to fact that Part containers creates a local coordinate system that can be shifted from global one. This local referential is then used by subsequent objects but isn't correctly handled by several functions (eg. export).

Usage

Functionally, the macro will reset the Part containers placement to global origin while preserving the objects absolute position. Notice that PlacementAbsolufy macro applies to the whole active document.

To use the macro, just run it when the document on which it shall be applied is open.

Installation

The macro is available through Addon Manager. Code is provided on this page for convenience in case user system doesn't have git-python. Though it should be up-to-date, latest release is always available at FreeCAD-macro repository

For more detailed explanations, see the How to install macros page.

Script

ToolBar Icon

Macro_PlacementAbsolufy.FCMacro

#!/usr/bin/python
#####################################
# Copyright (c) openBrain 2019
# Licensed under LGPL v2
#
# This macro will reset position of all part containers to document origin while keeping the absolute object positions
#
# Version history :
# *0.2 : some typo improvement + commenting for official PR
# *0.1 : alpha release, almost no test performed
#
#####################################

__Name__ = 'PlacementAbsolufy'
__Comment__ = 'Reset part containers to global origin while keeping object positions'
__Author__ = 'openBrain'
__Version__ = '0.2'
__Date__ = '2019-06-10'
__License__ = 'LGPL v2'
__Web__ = 'https://wiki.freecad.org/Macro_PlacementAbsolufy'
__Wiki__ = 'https://wiki.freecad.org/Macro_PlacementAbsolufy'
__Icon__ = ''
__Help__ = 'Run the macro with model active in the GUI'
__Status__ = 'Alpha'
__Requires__ = 'FreeCAD >= 0.17'
__Communication__ = 'https://forum.freecad.org/viewtopic.php?f=3&t=36869'
__Files__ = ''

currState = {} #initialize a dictionary to store current object placements

for obj in App.ActiveDocument.Objects: #going through active document objects
    if "Placement" in obj.PropertiesList: #if object has a Placement property
        currState[obj] = obj.getGlobalPlacement() #store the object pointer with its global placement

App.ActiveDocument.openTransaction("Absolufy") #open a transaction for undo management

for obj, plac in currState.items(): #going through all moveable objects
    if obj.isDerivedFrom("App::Part"): #if object is a part container
        obj.Placement = App.Placement(App.Vector(0,0,0),App.Rotation(0,0,0)) #reset its placement to global document origin
    elif obj.TypeId[:5] == "App::": #if object is another App type (typically an origin axis or plane)
        None #do nothing
    else: #for all other objects
        obj.Placement = plac #replace them at their global (absolute) placement

App.ActiveDocument.commitTransaction() #commit transaction

Limitations

  • Process the whole open document

Forum discussion

For any feedback (bug, feature request, comments, ...), please use this forum thread: Preserving global position of Parts during export

Ta strona pochodzi z https://wiki.freecad.org/Macro_PlacementAbsolufy

Bądźmy w kontakcie!
Forum GitHub Mastodon Matrix IRC Gitter.im Discord Reddit Twitter Facebook LinkedIn

© Załoga FreeCAD. Autorami grafiki na stronie głównej (od góry do dołu) są: ppemawm, r-frank, epileftric, regis, rider_mortagnais, bejant.

Ten projekt jest wspierany przez: , KiCad Services Corp. oraz pozostałych sponsorów

GitHubUlepsz tę stronę na GitHub