Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

Set Material FS very slow

romeograhamromeograham Member, csevp Posts: 678 PRO
@MBartlett21 I'm pretty sure this is your great Feature Script
https://cad.onshape.com/documents/3ca261a95938af152088fca8/v/e1a0d34103707be3050748c8/e/82151ac6fb25c86ba23d7f85

It seems to be very very slow in many of my models.


Do you have any idea why this might be? Is there something I should do differently?

Could it be that it hasn't been updated since last year (is the FeatureScript old?).


Thanks!
Romeo

Comments

  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,215
    I think that custom feature evaluates the volume of the selected parts up to three times, depending on the options (and I'm guessing your parts are somewhat intricate).  Morgan, you can optimize this by computing a part-to-volume map once and reusing it.  I don't expect age is an issue, but moving the FS and std version forward is a good idea: it will let the feature take advantage of whatever bugfixes we may have made since.
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,050 ✭✭✭✭✭
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • romeograhamromeograham Member, csevp Posts: 678 PRO
    Looks like the update could have been helpful after all..

    Before updating FeatureScript (29.66s):

    ...and after (13.8s):


    (although everything seemed a little quicker in the "after" screenshot for some reason, nothing else improved by more than 50%!)

    thanks!
    Romeo



  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,215
    Thanks, Morgan!
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • Henk_de_VlaamHenk_de_Vlaam Member, Developers Posts: 241 ✭✭✭
    edited December 2019
    @MBartlett21,

    Morgan, I play with this nice FS because we have to set the weight of parts that are 3D printed with (20%) infill. We weight the parts and set their weight in OS with Set Material and balance them in CAD with their actual weight.
    Now I have a few questions:
    1. Sometimes the weight is not set.
      I think I have discovered why: to the part (parts) there was previously the material PLA (or another) assigned from the Onshape Material Library. Even if the weight is correctly set by the FS and the weight is replaced by assigning a material, "Set Material" does not occur again, even after the material - None - is assigned. Is this correct? If so, How do I get FS "Set Material" active again?
    2. In FS "Set Material" I entered the material name in the hope that it would be visible in the title block of the drawing. Unfortunately not. What is the intention of that name?
    Maybe I am doing things wrong or I do have wrong expectations. Please can you help me (with a manual).
    Henk de Vlaam (NL)
  • richard_marcusrichard_marcus Member Posts: 17 EDU
    @MBartlett21

    Is it possible to update this to work for Composite Parts? I was playing around and changed the following in your code:

    annotation { "Name" : "Parts", "Filter" : EntityType.BODY && BodyType.SOLID }
            definition.parts is Query;

    to 

    annotation { "Name" : "Parts", "Filter" : EntityType.BODY }
            definition.parts is Query;

    This worked for me and allowed me to select my Composite Part, but I imagine this is not robust at all since a composite part could be composed of any number of things that are not Solids. I don't know Feature Script well enough to make this fail proof and root out only the solids in that query.

    Thanks.
  • MBartlett21MBartlett21 Member, OS Professional, Developers Posts: 2,050 ✭✭✭✭✭
    Henk_de_V said:
    1. Sometimes the weight is not set.
      I think I have discovered why: to the part (parts) there was previously the material PLA (or another) assigned from the Onshape Material Library. Even if the weight is correctly set by the FS and the weight is replaced by assigning a material, "Set Material" does not occur again, even after the material - None - is assigned. Is this correct? If so, How do I get FS "Set Material" active again?
    2. In FS "Set Material" I entered the material name in the hope that it would be visible in the title block of the drawing. Unfortunately not. What is the intention of that name?
    (1)
    Yes, your reasoning is correct.
    To get it active again, you will have to open the properties dialog and reset all the properties by clicking the button in the bottom left. WARNING: This will also reset properties other than material, such as name, description, appearance and custom properties.

    (2)
    It should show in the title block.
    It won't show if you do a drawing of the Part Studio. It also won't show properly if you set a material, like you found in (1).
    mb - draftsman - also FS author: View FeatureScripts
    IR for AS/NZS 1100
  • Henk_de_VlaamHenk_de_Vlaam Member, Developers Posts: 241 ✭✭✭
    edited January 2020
    @MBartlett21,

    Thank you for your answers. It's clear and the FS works fine now.

    My question '2' arose from the coincidental fact that I did indeed missed the material on a drawing of a part studio. You will just see it because normally I make drawings from parts only.

    Just a question: isn't it possible to edit the FS 'Set Material' so that it resets only the material property when setting a FS-material? That will make the FS more predictable.
    Henk de Vlaam (NL)
Sign In or Register to comment.