Why Are Edges Visible on My Models?

 
 
 

Visible edges are hidden lines that are normally invisible in 3ds Max. The problem typically occurs with Revit models because everything exported from Revit is triangulated. This causes edges that 3ds Max would normally hide to become visible.

Note This visible edge problem applies if you export from Revit version 2010 and earlier. This problem has been addressed for Revit 2011, so as of that version, objects now export with hidden edge information.

What Are Visible Edges?

You can recognize a visible edge, for example, if you have a wall in Revit that should only be represented in 3ds Max with four edges which are the four sides of the wall. Instead, 3ds Max displays the middle triangle that connects both corner vertices. This middle triangle is normally hidden.

Use this script to hide any unwanted edges from imported models, typically Revit version 2010 and earlier models loaded in 3ds Max using FBX. The script will read all edges and determine which ones can be hidden by evaluating whether they are next to any neighboring edges. Hiding these unwanted edges makes the model much easier to view.

To use this script:

  1. Select all objects in the scene.
  2. Select MAXScript New Script in the 3ds Max main menu.
  3. Copy and paste the script below into the dialog.
  4. Press CTRL-E to Evaluate All and run the script.

You can also save this script in 3ds Max and drag and drop the .ms file in the Viewport while objects are selected.

Note This script works only for editable meshes, and ignores editable polys, patches, or other entities.
(
	-- do this in a local scope so I don't pollute the global scope.
	function setVisibilityEdges obj =
	(
		local edgeSelSet = #()
		-- Go through all faces
		local numFaces = obj.numfaces
		for faceIndex = 1 to numFaces do
		(	
			-- And for every one of the 3 edges
			for edgeIndex = 1 to 3 do 
			(
				--collect the edge
				append edgeSelSet ( ((faceIndex-1)*3) + edgeIndex )
			)
		)
		-- Select all visible edges
		meshop.autoedge obj edgeSelSet 5 type:#setclear 
	)
	--==============================================
	-- Start of the runtime script
	--==============================================
	local timestart = timestamp()
	-- turn off undo during this operation.
	with undo off
	(
		local editMeshArray = #()
		for obj in Selection do
		(
			if (classof obj == Editable_Mesh) do
			(
				-- collect all the edit meshes first, because the
				-- user could have selected some helper objects too, which we
				-- don't want to process.
				append editMeshArray obj
			)
		)
		-- we don't need to hold the selection anymore, clear it out.
		clearselection()
				-- Array of object handles that have already had their edges hidden
		local allReadyProcessed = #()
		-- iterate through all selected edit meshes...
		for editMeshobj in editMeshArray do
		(
			local found = (FindItem allReadyProcessed editMeshobj.handle) > 0
			if (not found) then
			(
				setVisibilityEdges editMeshobj
				append allReadyProcessed editMeshobj.handle				-- Mark all the instances as processed too!
				InstanceMgr.GetInstances editMeshobj &repeatArray
				if (repeatArray.count > 0) then
				(
					-- mark them as processed by adding their handle to the array
					for repeat in repeatArray do
					(
						append allReadyProcessed repeat.handle
					)
				)
			)
		)
	)
	redrawviews()
	local timeend = timestamp()
	format "Total time: % (seconds)\n" ((timeend - timestart)/1000.0))