Model.fileupdate#

Model.fileupdate(name, comparerule='1', keepremovedparts='', keywordstofilter='')#

This function compares and updates the parts present in the incoming *.hm model file with the session model and creates a Partsets category with comparison results.

Parameters:
  • name (hwString) – The full path of the *.hm file to be compared with the session model.

  • comparerule (hwString) –

    This specifies the revision rule to be compared.

    1 - Only Major revision will be compared.

    2 - Major and Study revision will be compared.

    3 - Major, Study, Library revision will be compared.

  • keepremovedparts (hwString) –

    Keep the parts that exist in session and do not exist in the incoming file.

    0 - Deletes the removed parts.

    1 - Keep the removed parts.

  • keywordstofilter (hwString) – A comma separated list of parts to ignore comparison. It can be the complete name or a substring of a name.

Example#

Compare and update from the file C:/temp/BOMPartImport.hm#
import hm
import hm.entities as ent

model = hm.Model()

model.fileupdate(name="C:/temp/BOMPartImport.hm")
Keep the removed parts#
import hm
import hm.entities as ent

model = hm.Model()

model.fileupdate(name="C:/temp/BOMPartImport.hm", keepremovedparts="1")
Filter a few parts like “LeftOuter_A” and “LeftInner_A_Weld” and ignore them from comparison#
import hm
import hm.entities as ent

model = hm.Model()

model.fileupdate(
    name="C:/temp/BOMPartImport.hm",
    keywordstofilter="LeftOuter_A,Weld"
)
Compare and update using Major revision#
import hm
import hm.entities as ent

model = hm.Model()

model.fileupdate(name="C:/temp/BOMPartImport.hm", comparerule="1")