Announcement

Collapse
No announcement yet.

Neep Some Help with STEP File Handling

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Neep Some Help with STEP File Handling

    Working on a small project for an old friend of mine. He gave me some CAD files in STEP format (not sure what created them). Hoping somebody here that deals with CAD stuff will know something about this... As I know nothing about it

    They import as Body Object files. I suppose I should convert these to Edit Poly or Edit Mesh for use with VRay?

    Am I right in thinking that if I want a fine mesh I need to first set the Viewport Display Settings to "Fine" and then convert to Edit Poly?

    The came in with a huge hierarchy for each part. I selected all the child objects and unlinked them (nothing is going to animate, anyway).

    Anything else I should know about these files? Tips/tricks/gotchas?

    Thanks.

  • #2
    Interesting thread.

    EDIT: Content removed because I was incorrect about a number of things.
    Last edited by Deflaminis; 17-06-2015, 04:02 AM.

    Comment


    • #3
      In most cases it´s good to keep them as body objects, that´s true. But there are cases and reasons to convert them to a mesh. Especially when you have to deal with very large files. Converted to a mesh (not poly !!)will decrease your scene size to 1/3 of the size it would be with body objects. Also body objects are a pain to select in the viewport. Max is not that bad at converting them to a mesh. Many errors that are visible in the viewport will be gone when you convert them to an editable mesh. Adjust the viewport resolution before converting them.If you´re not super close sometimes even medium settings will do the job. If you need it finer than the "fine" preset decrease face approx angle and face distance (carefully ). If you decide to convert them always keep a file with the initial body objects, just in case.

      There are certain modifiers that can be added on top of a Body object. Bend for example. Also an uvw modifier will keep the render resolution untouched. Once you imported a STEP file the first thing you should do. Select all objects, unlink, hide by category.. all but helpers. Select all helpers and delete them. Sometimes there are thousends of helpers that are not needed. In the create/geometry/body objects menue you will find a Body Utility. You can use this to mass change settings for selected body objects.

      Depending on the source you may experience flipped faces. xview will only work on editable polys. So that´s not always an option. Anyway you can still identify them in subobject level "face". They are a bit darker shaded as correctly flipped faces. To flip faces on a body object you need to hit the "face flip" button first wich will bring up another rollout. You also can flip faces once converted to editable mesh in subobject level "element". In very rare cases faces are flipped but you can´t identify them in viewport. You will notice they are wrong when rendering eihter a refractive material or a material with fresnel reflections wich than will turn to 100% reflections. You can identify them by applying a vray2sidemtl. choose some colors like red for front and green for back material. translucency pure white. "force single sided sub mats" off.

      If you have to deal regularly with STEP files I would recommend Power Translator from Npower Soft.

      Comment


      • #4
        Originally posted by Deflaminis View Post

        But if you MUST have access to the uvs, then it will convert to a mesh/poly object and get ugly quick. My opinion is use a different package and export it from there as a poly object. Max is horrible for converting these, and using Rhino demo or Catia, anything, will be better. If you convert in max, you won't have the smoothest lines and it won't subdivide or parameterize it properly to apply a turbosmooth to it , so you're really signing up for a lot of unneeded work.

        AJ
        I'll contest this point.. sorry .. We actually had way better results with 3dsMax Importer that other products in the last years.. ( 3dsMax 2014 and up) We have a 'preset script' that basically sets the quality settings, and converting ( but nothing you cannot do by hand)

        Our workflow consist of:
        Setting presets for required quality - playing around with the mesh quality options
        In body objects - welding category
        In welding - click split edges
        click weld now
        Add an edit mesh modifier - collapse ( works better that convert to mesh from right click quad menu, don't know why)

        For decals, we are using VrayBlends

        You got a really clean mesh..

        As mentioned, works better with mesh than poly, at least for our workflow..

        We are dealing with dozen of step files each day, and we had an external solution (Npower and others) and we changed our workflow for a 100% 3dsMax, as it was faster and easier for us.
        Also, the 3dsMax body object module is an Npower implementation, so kind of works in the same way.. (and not totally scriptable unfortunateley, a few workarounds are needed to automate the process)

        However, you are always dependent, whatever is the solution you use, of how good the provided file is, and sometime the step file is not the problem, it is the file provider..
        Last edited by thablanch; 27-02-2015, 05:50 AM.
        Alain Blanchette
        www.pixistudio.com

        Comment


        • #5
          I’ve been working with STEP files in a new job for 6 months now and am currently trying out a 30 day demo of Npower translator. I’ve found it works best at bringing in STEP file in correct units, edges already welded, and cleans up problem files better than default max import. However it brings in models as a proprietary object type that I then have to convert to body objects for compatibility with other office users. This is a pain as it has to be done object by object and can’t be scripted. Creating shortcut keys does the job fairly quickly though.
          If you go the collapse edit mesh modifier route, mentioned above, I suggest you download an AutoEdge script at Scriptspot to clean up meshes in the viewport.
          Greg Geffert
          Spectrum Brands
          www.greggeffert.com

          Comment


          • #6
            Wow, guys! Awesome info, thanks!

            I did find the Body Objects were *really* hard to select.

            I got through the delete all the helpers/nulls part right away. I was having none of that!

            Good to know that Mesh works better than poly. I messed around a little with both. They both made terrible meshes, but they rendered OK. I will likely go with Mesh, as it is usually faster in the viewport for dense models.

            Is there some quick way to assign everything a VRayMtl that matches the wire color? (Will check Script Spot (which is down right now); this has to be easy, or even built in... anyone?) Or is there a Map that reads wire color? This would be even better, as I could use just a few Mtls, reading the diffuse color from the wire color.

            Comment


            • #7
              So I made this quick little script to add VRayMtls with the wire color as the diffuse color:

              Code:
              -- Assign VRayMtl with Wire Color as Diffuse Color
              for o in $ do 
              ( 
                  o.material = vraymtl name:(o.name +"_Mtl") diffuse:(o.wirecolor)
              )
              Maybe somebody else will find it useful. Ideally I could instead set a user_color to the wire color (need to figure out how to do that in MaxScript. I know C, perl, Java, JavaScript, etc. quite well, but need to learn the maxscript syntax details)
              Last edited by Joelaff; 27-02-2015, 11:59 AM.

              Comment


              • #8
                OK. I made it set the user_color...
                Code:
                -- Convert Wire Color to User Color
                for o in $ do 
                ( 
                    c = o.wirecolor as point3
                    setUserPropBuffer o ("user_color = "+((c[1]/255.0) as string)+","+((c[2]/255.0) as string)+","+((c[3]/255.0) as string) )
                )
                So now I can run this on all objects, then assign a VRayMtl with a UserColor Map in the Diffuse slot to them all and they render. This way you could select a few objects at once and adjust their other properties like reflectivity and glossiness, etc.. Theory being to give you just a few materials to adjust with each object still having its own diffuse value.

                Seems useful for this CAD type stuff, where, as mentioned above, they are mainly interested in the shape, lighting, and color, not super fine texture details. At least that is all my guy wants for this.

                Of course this does overwrite the existing user properties buffer completely. Ideally it would read the current buffer and copy over any values other than user_color.

                Also, it would be nice if you can have VRayMtl display the user_color in the viewport. Of course in this case you could simply change your display mode to object colors rather than material colors (because all we did was copy the wire colors).

                For those that don't know what user_color is see here:

                http://docs.chaosgroup.com/display/VRAY3/VRayUserColor

                I think this requires VRay 3.0+
                Last edited by Joelaff; 27-02-2015, 11:59 AM.

                Comment


                • #9
                  I improved the first script even further...

                  This script creates one VRayMtl per *unique* wire color. It assigns that wire color to the diffuse value, and names the material after the wire color. You can change "use_existing" at the top if you want to use any existing materials in the scene that already have the same name (like if you ran the script, modified a material and ran the script again... Of course you are likely to run a script like this just once after you import your objects.) So you end up with as few materials as possible vs. the first script that just creates one Material per object.


                  Edit: Fixed a bug with existing scene materials. Use this new version.

                  Code:
                  -- Convert Wire Color To Few VRayMtl
                  --
                  --Select the objects for which you want to create VRayMtls with Diffuse values that match their Wire Colors and run this script
                  --
                  --
                  
                  mat_prefix = "VR" -- Prefix for the created materials - Keep this short so you can read the names easily in the mat editor
                  use_existing = false --Should we use an existing material with the same name, or create a new one with _nn (incremented number) appended ?
                  
                  
                  
                  
                  fn CreateMaterial mat_name wc &mc=
                  (
                  	local mat = undefined
                  	
                  	if (mat_name != undefined) then
                  	(
                  		print ("Creating New Material: " + mat_name)
                  		mc = mc + 1 -- increment material count
                  		mat = vraymtl name:(mat_name) diffuse:(wc)
                  	
                  	)
                  
                  	--return the mat
                  	mat
                  )
                  
                  
                  
                  seen = #() --Create empty array which is used to ensure uniqueness of newly generated materials
                  mat_names = #() -- a parallel array with #seen that contains the actual material names used if there were duplciate
                  obj_count = 0
                  mat_count = 0
                  mat_name = ""
                  
                  
                  for o in $ do 
                  ( 
                  	local m
                  	obj_count = obj_count + 1
                  	--generate material name
                  	c = o.wirecolor as point3
                  	color_string = "_r" + ((integer)c[1] as string) + "_g" + ((integer)c[2] as string) + "_b" + ((integer)c[3] as string)
                  	
                  	print ("Obj: "+o.name+" has Wire Color: " + color_string)
                  	
                  	mat_name = mat_prefix + color_string
                  
                  	
                  	if( appendIfUnique seen mat_name ) then
                  	(
                  		-- We have not yet seen this wire color
                  		
                  		if( undefined != sceneMaterials[mat_name] ) then
                  		(
                  			-- A scene material with our name already exists
                  			
                  			if( use_existing ) then 
                  			(
                  				-- we want to use the existing scene material with our name
                  				print ("Using Existing Scene Material: " + mat_name)
                  				m = sceneMaterials[mat_name]
                  				
                  			)
                  			else
                  			(
                  				--we want to make a new material with a unique name
                  				local new_mat_name
                  				
                  				--create a unique name
                  				local j = 0
                  				do
                  				(
                  					j = j + 1
                  					new_mat_name = (mat_name + "_"+(j as string))
                  				) while (undefined != sceneMaterials[new_mat_name] or j > 20000) -- arbitrary break if it takes too long
                  				
                  				-- update the actual material name
                  				mat_names[findItem seen mat_name] = new_mat_name
                  				
                  				m = CreateMaterial new_mat_name o.wirecolor &mat_count
                  			)
                  		)
                  		else
                  		(
                  			-- a material with our name does not exist in the scene
                  			
                  			-- update the actual material name
                  			mat_names[findItem seen mat_name] = mat_name
                  			
                  			m = CreateMaterial mat_name o.wirecolor &mat_count
                  		)
                  		
                  
                  	)
                  	else
                  	(
                  		-- We already made a material with this name during this execution. Use the existing one.
                  		existing_mat_name = mat_names[findItem seen mat_name] 
                  		if( undefined != existing_mat_name) then
                  		(
                  			print ("Using Material We Just Created: " + existing_mat_name)
                  			
                  			m = sceneMaterials[existing_mat_name]
                  		)
                  		else
                  		(
                  			print ("Using Scene Material we have already used: " + mat_name)
                  			
                  			m = sceneMaterials[mat_name]
                  		)
                  		
                  	)
                  	
                  	
                  	-- Assign the material to current object
                  	o.material =m
                  ) 
                  
                  (
                  	print ("Total Objects Processed:" + (obj_count as string))
                  	print ("VRay Materials Created: " + (mat_count as string))
                  	OK
                  )
                  Hope this helps somebody...
                  Last edited by Joelaff; 27-02-2015, 05:25 PM.

                  Comment


                  • #10
                    I fixed a bug in the script for cases where you already have existing materials with the same name (it could have hung in an infinite loop ). Added a break out to avoid infinite loops. Added some totals. Removed inefficient "return" statements.

                    If anyone wants to modify, fork, etc. feel free.

                    Use at your own risk
                    Last edited by Joelaff; 27-02-2015, 05:10 PM.

                    Comment


                    • #11
                      Originally posted by thablanch View Post
                      I'll contest this point.. sorry .. We actually had way better results with 3dsMax Importer that other products in the last years.. ( 3dsMax 2014 and up) We have a 'preset script' that basically sets the quality settings, and converting ( but nothing you cannot do by hand)
                      Don't be sorry, that's the point of a forum, to share. I wasn't able to find a decent workflow, but if you did that's great and I want to give it a shot. I'm not here to measure egos, just find solutions. I'll have to try this and thank you.

                      EDIT: Interesting this definitely does fix the gaps that I was getting. I totally missed this when in the past when I was trying to do this. This is a huge improvement and thanks for the tips.
                      Last edited by Deflaminis; 28-02-2015, 04:27 AM.

                      Comment

                      Working...
                      X