Unselectable Viewport – unclipping a viewport with a deleted boundary

So you have an unselectable viewport?

This could be a symptom of several conditions.

  1. The viewport itself is on an off layer. This will show the content but no boundary so the viewport cannot be selected and moved etc. Check whether the viewport layer is off by turnign all layers on and unfreezing all layers. This should then reveal the boundary.
  2. The viewport has been put on Defpoints, which when combined with Layer 0 being off will display the viewport boundary but it will be unselectable. This is why Defpoints should not be used for any user geometry.
  3. Lastly and this is what I encountered today which is the first time for me is that someone has clipped the viewport and then deleted the clipping boundary. This gives a viewport that is completely unselectable by the mouse. However it can be selected using Quickselect, see below for the method to remove this viewport.

Unclipping a clipped viewport that has had its boundary delelted!

Firstly we need to create a rectangle, this is needed for a later step.

Then run Quickselect (its on the “Home” tab under the “Utilities” group),

Quick select location
Quick select location

and then select “Viewports” from the dropdown box at the top. Then go to the bottom box and select “Select All”.

Select all viewports
Quick select all viewports

Once all the Viewports are selected and if there are other viewports you want to keep, use the shift key to de-select the ones that have borders leaving only the one that has no boundary.

Then go to the layout tab and select “Clip”, and select the rectangle you created at step one. This will clip the old viewport to the rectangle.

View port clip
Viewport clip

You can now either delete the viewport and rectangle or move and edit the viewport as required.

I would however suggest deleting the viewport and rectangle as this issue could happen again and create a new viewport using the layout tab new rectangular viewport option.

Random glitches, flat ucs and icon solid hatch

A colleague of mine could not hatch dots on a drawing at a higher density. I tried the usual regen and measurement commands to see if it was the hatch itself, however it was not to do with this.

After searching it could be a variable issue in the drawing but the drawing was from our standard template, but worth checking to see if HPMAXAREAS and HPMAXLINES were set to low values. They were not.

After further searching it became apparent that the drawing was a long way from the origin causing the glitches. This was apparent because the x leg of the UCS icon kept disappearing on zoom when in world UCS.

The glitches were:

  • Hatches not hatching properly at higher densities
  • ONSNAP not working properly
  • Fillet and trim not working properly

The solution was to create a drawing UCS closer to the drawing that fixed these glitches.

Creating a default layer sheet

As part of my preparing an AutoCAD drawing for my office’s layering system I managed to insert layers into a drawing from Excel using only scripting.

However the creation of a line and a text on each of the layers, so that users can copy and paste to get the layers etc. into new drawings, needed full AutoCAD and its access to LISP to create these quickly.

The script below is a modified (larger text and longer lines) version of a script, kindly written, from here.

(defun c:lintextfromlayer (/ pt dat ln)
(setq pt (getpoint “\nSelect insertion point: “))
(while (setq dat (tblnext “layer” (null dat)))
(entmake (list ‘(0 . “line”) (cons 10 pt) (cons 11 (mapcar ‘+ pt ‘(5000 0 0))) (cons 8 (setq ln (cdr (assoc 2 dat))))))
(entmake (list ‘(0 . “text”) (cons 10 (mapcar ‘+ pt ‘(5200 -125 0))) ‘(40 . 250) (cons 1 ln) (cons 8 ln)))
(setq pt (mapcar ‘- pt ‘(0 1000 0))))
(princ))

 

Excel to AutoCAD layers

I have been attempting to update our office’s layer system. This would be difficult to do in AutoCAD without resorting to LISP or some programming to insert layers on mass. Creating lots of text on mass is really easy to do in Excel so that would be the program of choice to do this task.

The problem then comes of getting these layers into AutoCAD? There are numerous Lisp programs around on the internet to do this but what if you have AutoCAD LT only (as it lacks programming APIs)?

You can use Excels powerful cell commands to convert your layer list to a format that will then be able to create a script file. Below I will go through the steps you need to do to get this to work. (Note this is not my concept but I cannot find the original page where this was proposed).

Firstly create a blank Excel document.

Then place “-LAYER” in the 4th column over.

Now we are ready to input some data into the first three columns. This is in the order, layer name, colour, linetype. Make sure the second column for colour is text only to avoid any true colours being converted into numbers.

One completed we will now enter the following command below the cell with -layer in.

=IF(ISNUMBER(SEARCH(“,”,B2)),”N “& CHAR(34)&TRIM(A2)& CHAR(34)&” C T “&TRIM(B2)&” “& CHAR(34)&TRIM(A2)& CHAR(34)&” LT “&TRIM(C2)&” “& CHAR(34)&TRIM(A2)& CHAR(34),”N “& CHAR(34)&TRIM(A2)& CHAR(34)&” C “&TRIM(B2)&” “& CHAR(34)&TRIM(A2)& CHAR(34)&” LT “&TRIM(C2)&” “& CHAR(34)&TRIM(A2)& CHAR(34))

This creates the magic that is script. (Note the quotes are required for layer names with spaces).

Add layer information down the left and drag the little square in the bottom right of the excel cell to copy this to all cells below.

Once completed, save this file for future reference.

Copy the entire column of D and paste to a new file using paste values only.

Now the file is ready to become a script. Save as Formatted Text (space delimited) PRN file.

You should now have a text file that has the entire script for making your layers you need in it. Two steps to go!

Firstly we are going to rename the extension on the file (if you cannot see extensions follow this). This needs to be renamed from myscript.prn to myscript.scr.

Then open the file and add a return at the very end to create another line. This will terminate the last command and thus end the script.

Finally we load the script into AutoCAD using the command “script“.

Voila, all the layers are now in AutoCAD.

Xerox Printers AutoCAD Transparency Update

Recently we had Xerox printers installed and we could not get the transparancy to play nice with the printer, printing a small strip up the side of the page. We have now found a solution to the problem and after installing PS drivers and changing the settings on the driver page under the PC3 we use to the settings noted below all works fine. Thank you to placidrefining for their solution, which can be found on the following page. Whilst they note that this works with a 7970 printer, we have found that it works with our model as well.

 

I have posted the images below from that post here for reference.

xerox_transparency_working_pcl_settings

xerox_transparency_working_ps_settings-png

 

 

Hatch ribbon slow to load

So the hatch ribbon is slow to load? I found that the addition of custom hatches on a network path was the cause of the issue. Remove the network related path from the support files and the hatch command speeds up considerably. This seems to be a similar problem to that of the MTEXT problem I have encountered previously.

Polyline doesn’t plot its lineweight

Today a colleague of mine could not plot a polyline at the desired lineweight. We tried different layer with the colour changed to see if was the plot style interferring. Tried turning off scale lineweights. Tried overriding the lineweight on the object itself.  Tried a new plot style.

After all these attempts it occured to me that the polyline thickness might have a impact on the lineweights and it does.

Altering the polyline global width to 0 meant the lineweight now plotted correctly.

Nested XREFs and layer states

If you use a system of drawing sheet and drawing model in your practice where both are seperate files and the sheets are like a piece of paper with the drawing information pulled into it then this is something you might have come across already, if not then this might help you in the future if you encounter it.

So generally you will attach one or two external drawings to a sheet file and then adjust layers to suit in the sheet file. However occaisonally you will set up a drawing with an XREF, usually an overlay type of drawing (not to be confused with overlay type of XREF) where you have a base drawing and the layers are adjusted to be simplistic and then further information is drawn over the top, e.g. a fire drawing or drainage drawing.

Xref_layerinfoattached

This is where it gets complicated. There is now a chain of drawings. Drawing A (the base drawing) –> Drawing B (the overlay type of drawing) –> Drawing C (the plot drawing). [Note: the arrows indicate XREF attachements]. This chain of XREFs is called nesting.

The problem comes when you want Drawing C to look the same as drawing B does. When you attach Drawing B to C all the layers on drawing A change to when they were first attached to drawing B, all the changes in drawing B seem to be lost. But when you go back to drawing B it still looks as it should. Confused?

The problem is AutoCAD pulls in XREFs (external references) from their source files and not through the nesting. So any information for drawing A setup in drawing B will not be imported into C as drawing C as the information is directly pulled from drawing A.

Xref_nestedlayerinfoattached

In order to circumvent this annoying behaviour layer states export and load should be used. Or you just reset them up if its only a few changes, but if lots of colour changes and layer adjustments have been made then this is the method for you.

This is taken from this page: (Copyright AutoDesk).

To export layer settings

  1. At the command prompt, enter LAYER.
  2. In the Layer Properties Manager, click Layer States Manager.
  3. In the Layer States Manager, create a new layer state or select an existing one. Click Export.
  4. In the Export Layer State dialog box, enter a file name and specify a location for the file.
  5. Click Save.
  6. Click OK to close each dialog box.

To restore layer settings

  1. At the command prompt, enter Layer on the command line.
  2. In the Layer Properties Manager, click Layer States Manager.
  3. In the Layer States Manager, select a named layer state.
  4. Select the settings that you want to restore.
  5. Click Restore.
  6. Click OK

Now you should have the correct layer information in drawing C!

Zoom extents ucs follow

Autodesk, oh Autodesk. Why do you not bother to fix major bugs? There are two zoom extents bug associated with UCSFOLLOW. One is one hatching and the other is when double clicking in the viewport. Whilst the viewport one can be controlled by locking the viewport, the hatching one can only be solved by turning off the UCSFOLLOW command. Which is silly really.

Grip edits not working

Introduced quite a while back for polylines and a while back for hatch, these allow you to add, edit and stretch existing lines by editing the blue square grips.

Gripedit01

However sometimes on polylines the edit menu for removing does not appear. This is usually due to two overlapping grips being present in the same space.

Gripedit02

To solve this problem, move the grip between the two points that don’t work to reveal the hidden overlapping grips. Now you should be able edit the grips again.

Gripedit03