Author Topic: ( C3D ) Linetypes in Model Space?  (Read 9358 times)

0 Members and 1 Guest are viewing this topic.

sinc

  • Guest
( C3D ) Linetypes in Model Space?
« on: November 19, 2006, 10:18:00 AM »
I notice that C3D seems to want to work with PSLTSCALE=1 and LTSCALE=1.

However, there's a problem with this, that has existed since Autodesk introduced paperspace.  When Autocad is set this way, no linetypes are visible in modelspace.  This makes it harder to work in drawings.  Since this problem has already existed for so many years, I suspect it's one of those things that Autodesk doesn't think is a problem and refuses to fix.

Is there any workaround for this issue?  Do people just get used to working in drawings that don't display linetypes?  Or do people usually just switch it back to PSLTSCALE=0?  Constantly changing PSLTSCALE and LTSCALE is not a feasible option.
« Last Edit: November 19, 2006, 10:25:50 AM by sinc »

Dinosaur

  • Guest
Re: ( C3D ) Linetypes in Model Space?
« Reply #1 on: November 19, 2006, 11:25:18 AM »
If I have only one drawing scale in use I set the LTScale to the drawing scale, set all the viewports to PSLTScales to 0 and edit either in the model or through the viewport.  I am not seeing the program changing the LTScale  or PSLTScales on its own.  Once the values are set, they seem to stay.  All NEW viewports do want to default to PSLTScale 1 on creation since at least 2006 and I have noticed that each viewport must be changed individually.  If there a multiple scales in a drawing, the only alternative is to have the "1" and "1" settings and edit through a viewport instead of in the model.  I am warming up to the maximize viewport feature although it is annoying when the C3D labels and the visual for the ltscale change when there is an update.

sinc

  • Guest
Re: ( C3D ) Linetypes in Model Space?
« Reply #2 on: November 19, 2006, 12:00:20 PM »
We can live with this one.  It just falls into that category of "You mean Autodesk hasn't fixed that YET?"    :ugly:

Dinosaur

  • Guest
Re: ( C3D ) Linetypes in Model Space?
« Reply #3 on: November 19, 2006, 12:22:12 PM »
It makes me yearn for r13.  I had the problem solved with a paperspace viewport reserved exclusively for editing.  There was on option in the linetype portion of the options pulldown that would preserve the correct display in any scale viewport as well as the model.  This loss of this is likely the number 3 reason for my hatred of LDT behind labels that insisted on being displayed upsidedown in unfortunately twisted viewports and arc labels that could not be rotated along the curve to avoid interfering labels

sinc

  • Guest
Re: ( C3D ) Linetypes in Model Space?
« Reply #4 on: November 19, 2006, 06:54:40 PM »
This loss of this is likely the number 3 reason for my hatred of LDT behind labels that insisted on being displayed upsidedown in unfortunately twisted viewports

You can actually get around that issue, with the North Rotation feature.

As for the arc labels that don't move, I haven't found any way around those.  Text mask doesn't work on them, either.  They're a pain.  One I'll be glad to forget about...   :-)

Cannon

  • Guest
Re: ( C3D ) Linetypes in Model Space?
« Reply #5 on: November 19, 2006, 07:28:00 PM »
Sinc, with your LSP knowledge, why haven't you written something that pushes LTSCALE to the DIMSCALE when in MS, to 1 when in PS? We had one for the past 5 years just to avoid the issue. It's like a 5 minute programming exercise for someone like you, and will make life better for all involved.

I think I have mine (in VBA, not nearly as elegant as the LSP solution I saw but it's what I know,) if someone really wants it.

sinc

  • Guest
Re: ( C3D ) Linetypes in Model Space?
« Reply #6 on: November 19, 2006, 07:41:05 PM »
Sinc, with your LSP knowledge, why haven't you written something that pushes LTSCALE to the DIMSCALE when in MS, to 1 when in PS? We had one for the past 5 years just to avoid the issue. It's like a 5 minute programming exercise for someone like you, and will make life better for all involved.

I think I have mine (in VBA, not nearly as elegant as the LSP solution I saw but it's what I know,) if someone really wants it.

I suppose you're right.  Although if you've already done it, it would save me needing to work through the details... (hint  ^-^)

Although I might also want to do it myself in Lisp.  I think I know how to go about it, with reactors, but haven't actually written any Lisp reactors yet...  It would be a good exercise.

Kind of begs to wonder though, if the fix is so easy, why hasn't Autodesk fixed it yet, after all these years?   :?

sinc

  • Guest
Re: ( C3D ) Linetypes in Model Space?
« Reply #7 on: November 19, 2006, 09:13:09 PM »
Sinc, with your LSP knowledge, why haven't you written something that pushes LTSCALE to the DIMSCALE when in MS, to 1 when in PS? We had one for the past 5 years just to avoid the issue. It's like a 5 minute programming exercise for someone like you, and will make life better for all involved.

OK, I went ahead and took the challenge...   :-D

Since I had to figure out how to work reactors, it actually took me over an hour, but I think I came up with something that works:
Code: [Select]
(vl-load-com)

(defun ltscale:LayoutSwitched (reactor layout / doc dimscale tilemode)
  (setq AcadObj     (vlax-get-acad-object)
        doc         (vla-get-activedocument AcadObj)
        dimscale    (vlax-invoke doc "getvariable" "dimscale")
        tilemode    (vlax-invoke doc "getvariable" "tilemode")
  )
  (cond
    ((= tilemode 0) ; paperspace
     (vla-setVariable doc "ltscale" 1)
     (vla-setVariable doc "psltscale" 1)
     (vla-regen doc 1)
    )
    ((= tilemode 1) ; modelspace
     (vla-setVariable doc "ltscale" dimscale)
     (vla-setVariable doc "psltscale" 0)
     (vla-regen doc 0)
    )
  )
  (if doc (vlax-release-object doc))
  (if AcadObj (vlax-release-object AcadObj))
)

(if (/= (type *switchViewportReactor*) 'VLR-Miscellaneous-Reactor)
  (setq *switchViewportReactor*
         (VLR-Miscellaneous-Reactor
           nil ; No data is associated with the reactor callbacks
           '
           ((:VLR-layoutSwitched . ltscale:LayoutSwitched))
         ) ;_ end of vlr-miscellaneous-reactor
  )
)
(if (not (vlr-added-p *switchViewportReactor*))
  (vlr-add *switchViewportReactor*)
)
(princ "FixLTScale.lsp Loaded.\n")

...I went back and added the releases that probably aren't necessary, but it's a good habit to always use them...
« Last Edit: November 19, 2006, 09:51:29 PM by sinc »

MMccall

  • Guest
Re: ( C3D ) Linetypes in Model Space?
« Reply #8 on: November 20, 2006, 04:24:02 PM »
for what it's worth ....

   After I get some basic linework in my project, enough to get an idea of size and potential sheet layouts,  I set by LTscale to the drawing scale I plan on using, PSLTscale to 0, setup the viewports with 'Align space', set the USC to 'view, and Dimscale to 0.   I do most of my work through the viewport into model.  Occasionally I'll enlarge the vp to work on something outside the current port.
« Last Edit: November 20, 2006, 09:14:46 PM by MMccall »

sinc

  • Guest
Re: ( C3D ) Linetypes in Model Space?
« Reply #9 on: November 20, 2006, 07:44:35 PM »
for what it's worth ....

   After I get some basic linework in my project, enough to get an idea of size and potential sheet layouts,  I set by LTscale to the drawing scale I plan on using, PSLTscale to 0, setup the viewports with 'Alignment space', set the USC to 'view, and Dimscale to 0.   I do most of my work through the viewport into model.  Occasionally I'll enlarge the vp to work on something outside the current port.

Yeah, that's a pretty typical way to work with Vanilla Autocad, at least when all your viewports are at the same drawing scale.  Do you use any sort of vertical?

Land Desktop is a bit more confusing.  The whole idea of using DIMSCALE=0 and placing labels in modelspace tends to fall apart - or at least, you have to fight Land Desktop to do it.  And you STILL have issues.  Land Desktop has a North Rotation option to sort-of deal with this problem (it's messy, but at least it's a way to get everything working without constantly fighting the software).

C3D is completely different still.  For the most part, it doesn't use the old-style stuff at all.  Old dimensions and labels are gone, replaced by new "smarter" objects, that are maybe sometimes a bit too smart... (or maybe not smart enough...)  This has gotten rid of many of the problems that plagued Land Desktop, but a few remain.  The little Lisp routine I posted uses reactors to fix an issue Autodesk has so-far failed to fix, and makes C3D work a bit more-smoothly...

MMccall

  • Guest
Re: ( C3D ) Linetypes in Model Space?
« Reply #10 on: November 20, 2006, 10:00:01 PM »
My Autocad experience is only with the Civil 3D variety.  Started with 2005.  Currently using 2006 sp2. Until recently, 2007 seemed too disruptive to implement.

I've never had the pleasure of using land desktop. :-P

While the C3d objects are very nice and functional, I still need a bunch of the basic stuff to complete a plan set.  I look for the simplest and most adaptable solutions.

Dinosaur

  • Guest
Re: ( C3D ) Linetypes in Model Space?
« Reply #11 on: November 20, 2006, 11:00:16 PM »
I will tell you a secret, MMccall . . . I use a lot of AutoCAD primitives in my drawings as well.  The eventual ideal is a file with nothing but Civil 3D objects and a title block if we must, but that ideal has not yet matured and I likely would not use it at any rate.  As I finish more pressing battles, I will use that time to bring more of the standard output into my requirements, but I am content with how I am using it at present.  My point is, there is nothing wrong in using the elements of Civil 3D that give you the results you want and ignore those features you are not ready to use.

b_hailey

  • Guest
Re: ( C3D ) Linetypes in Model Space?
« Reply #12 on: December 08, 2006, 02:56:34 PM »
I have a great routine that I wrote that changes your ltscale and psltscale depending on if you are in model space or paper space.  It's attached if anyone wants it.

Dinosaur

  • Guest
Re: ( C3D ) Linetypes in Model Space?
« Reply #13 on: December 11, 2006, 08:50:03 AM »
Thank you for making that available.  I am wondering if there is a way to do this without tying it to a dimscale.  I have drawings that contain multiple viewports of different scales and also many dimensions are in paper space, hence it is quite likely the current dimscale will not be the LTScale I need.

sinc

  • Guest
Re: ( C3D ) Linetypes in Model Space?
« Reply #14 on: December 11, 2006, 10:08:30 AM »
Thank you for making that available.  I am wondering if there is a way to do this without tying it to a dimscale.  I have drawings that contain multiple viewports of different scales and also many dimensions are in paper space, hence it is quite likely the current dimscale will not be the LTScale I need.

It would be very simple to tie it to some generic data bit that gets stored in the drawing, like in a generic dictionary.

It should also be possible to tie it directly to the Drawing Scale, but I'm not entirely sure how to access that...  The Civil-3D Automation documentation basically sucks right now.

Dinosaur

  • Guest
Re: ( C3D ) Linetypes in Model Space?
« Reply #15 on: December 11, 2006, 10:32:51 AM »
I can adapt certain bits of existing code if I know where to look for the changes and what to change things to.  I can find the reference to the dimscale in this code, but am lost after that point.  Could someone provide a flashlight for the greenest of lisp rookies?

b_hailey

  • Guest
Re: ( C3D ) Linetypes in Model Space?
« Reply #16 on: December 11, 2006, 02:15:17 PM »
Thank you for making that available.  I am wondering if there is a way to do this without tying it to a dimscale.  I have drawings that contain multiple viewports of different scales and also many dimensions are in paper space, hence it is quite likely the current dimscale will not be the LTScale I need.
That routine uses the dimscale as the default ltscale for model space.  If you type tmm (I don't know why I chose that, I just did) it will bring up the settings and you can set your model space ltscale to whatever you want as well as your paperspace ltscale.

Dinosaur

  • Guest
Re: ( C3D ) Linetypes in Model Space?
« Reply #17 on: December 11, 2006, 02:41:55 PM »
Excellent, that was the point where every other routine would fail for me.  The only one close to a solution kept messing with dimscales as well and would eventually AutoCAD would go unstable.  This one seems to work perfectly, thanks.  I was surprised to discover you were in what I remember to be a very small town where I would not have expected to find an Autodesk reseller.  I spent about 15 years in and around Thornton, CO and the closest one I knew of was in the Tech Center.  Happy things must be happening up north of Denver.  :-)

sinc

  • Guest
Re: ( C3D ) Linetypes in Model Space?
« Reply #18 on: December 11, 2006, 02:45:36 PM »
I was surprised to discover you were in what I remember to be a very small town where I would not have expected to find an Autodesk reseller.  I spent about 15 years in and around Thornton, CO and the closest one I knew of was in the Tech Center.  Happy things must be happening up north of Denver.  :-)

How long ago was that?   :lol:

Thornton and the Tech Center are basically two areas in one big city these days...

Dinosaur

  • Guest
Re: ( C3D ) Linetypes in Model Space?
« Reply #19 on: December 11, 2006, 02:48:29 PM »
They were back then (1977-1993) as well - just a lot of city in between them.  Frederick is several miles of what was then wheat field north of where Thornton ended.

EDIT

BTW, even though this issue seems to be solved, should anyone be interested in teaching an old dog some new tricks, I would still like to figure out how to make the changes to the routine that sinc was suggesting should a similar solution be needed for other problems, ie automatic scaling of blocks, etc.
« Last Edit: December 11, 2006, 02:54:22 PM by DinØsaur »

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: ( C3D ) Linetypes in Model Space?
« Reply #20 on: December 11, 2006, 02:54:11 PM »
It should also be possible to tie it directly to the Drawing Scale, but I'm not entirely sure how to access that...  The Civil-3D Automation documentation basically sucks right now.
Here's some help in that regard......
Code: [Select]
This will allow you to either get or set the scale...

Usage:
(get-put-dwgscale nil);;retrieves the current scale setting
(get-put-dwgscale 50.0);;sets the current scale setting to 50

No error checking provided, so make sure to pass either nil or a valid Real
number for the scale.

(defun get-put-dwgscale (scale / acadobj aecobj aecdoc)
  (if (and (setq acadobj (vlax-get-acad-object))
    (setq aecobj (vla-getinterfaceobject
     acadobj
     "AeccXUiLand.AeccApplication.4.0"
     ;;change to 3.0 for use in 2006
   )
   )
    (setq aecDoc (vla-get-activedocument aecobj))
    (setq zonesets (vlax-get
       (vlax-get
         (vlax-get aecdoc 'settings)
         'drawingsettings
         )
       'unitzonesettings))
    )
    (progn
      (if scale
 (vlax-put zonesets 'drawingscale scale)
 (setq scale (vlax-get zonesets 'drawingscale))
 )
      )
    )
  (vl-catch-all-apply '(lambda ()
   (mapcar 'vlax-release-object
    (list zonesets aecdoc aecobj acadobj))
   ))
  scale
  )

b_hailey

  • Guest
Re: ( C3D ) Linetypes in Model Space?
« Reply #21 on: December 11, 2006, 03:51:40 PM »
I was surprised to discover you were in what I remember to be a very small town where I would not have expected to find an Autodesk reseller.  I spent about 15 years in and around Thornton, CO and the closest one I knew of was in the Tech Center.  Happy things must be happening up north of Denver.  :-)

I've been with this company for about 4 months now (and loving it).  I used to be a design engineer up in Loveland.  CommTech used to be based out of Boulder but has since moved out to Frederick.  There are now three resellers in Colorado, one in the Tech Center, one in Thornton, and us.

sinc

  • Guest
Re: ( C3D ) Linetypes in Model Space?
« Reply #22 on: December 11, 2006, 06:03:26 PM »
I've been with this company for about 4 months now (and loving it).  I used to be a design engineer up in Loveland.  CommTech used to be based out of Boulder but has since moved out to Frederick.  There are now three resellers in Colorado, one in the Tech Center, one in Thornton, and us.

CommTech is our reseller.  We tried to get quotes from the other two, and they really dragged their heels (because we're too small?).  Commtech had us a quote later that day, I believe.  The others finally got us quotes, one roughly the same as Commtech and one significantly higher, but we had to call each of them several times in order to get the quotes.  We purchased from Commtech mainly because they were more responsive than the other two - the others really started to annoy us.

b_hailey

  • Guest
Re: ( C3D ) Linetypes in Model Space?
« Reply #23 on: December 12, 2006, 10:31:37 AM »
sinc,

I'm glad to here you like CommTech.  Would it be OK to use what you had posted in some of our promotional literature?  It might also be a good plug for your company (sounds like a win win situation to me).  I tried to PM you but it doesn't seem to be working.  If you would like, you can send me an e-mail at brianh at ctcivil dot com

Brian

sinc

  • Guest
Re: ( C3D ) Linetypes in Model Space?
« Reply #24 on: December 12, 2006, 12:18:00 PM »
sinc,

I'm glad to here you like CommTech.  Would it be OK to use what you had posted in some of our promotional literature?  It might also be a good plug for your company (sounds like a win win situation to me).  I tried to PM you but it doesn't seem to be working.  If you would like, you can send me an e-mail at brianh at ctcivil dot com

Brian

Sure.  Although you may want to edit it a bit...  If you included everything I said, it might start sounding like you're bashing your competition, which you may not want to do (at least, not obviously) in your promotional literature...   :-)

sinc

  • Guest
Re: ( C3D ) Linetypes in Model Space?
« Reply #25 on: March 25, 2007, 03:22:51 PM »
I've now incorporated this along with the rest of my routines.

But it's also become apparent that it's still often useful to use old-style Dimensions in Civil-3D.  That means we still have some of the same problems as in Land Desktop.

So, in addition to changing PSLTSCALE and LTSCALE as the user switches between modelspace and paperspace, it also sets the DIMSCALE to the Drawing Scale in modelspace, and DIMSCALE=0 in paperspace.  It also keeps the DIMSCALE set correctly when the user changes the DIMSTYLE in the dropdown box in the Styles toolbar.

(Note:  DIMSCALE=0 is much like DIMSCALE=1, except dimensions also scale correctly when they are created in model space through a viewport located in paperspace.  This makes DIMSCALE=0 a particularly useful setting in paperspace.  If you are confused about how to define DIMSTYLES and use DIMSCALE, you may want to read this explanation of how they work in Land Desktop.  They work in much the same way in Civil-3D, except Civil-3D has Labels instead of Text Style Sets.)

This doesn't solve all problems in Civil-3D.  Since it basically links the DIMSCALE to the DRAWING SCALE, you'll probably want to change DRAWING SCALE to match the viewport you are working on.   However, this has the unintended side-effect of causing ALL labels in modelspace to change size.  If you are creating labels that will be defined in viewports that are set to radically-different scales, this can be pretty annoying.  It's possible that I should create some other variable entirely (possibly one that works much like a system variable), and use it instead of the main Drawing Scale.  But this version works fairly well for now.

Here's the part of the C# code that works much like the Lisp in the above post:

Code: [Select]
/*
 * Created by Richard Sincovec
 * User: Sinc
 * Date: 3/25/2007
 * Time: 8:15 AM
 *
 */

using System;
using ACAD = Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AECC.Interop.Land;
using Civil3DUtilities;

namespace Sincpac.Misc
{
/// <summary>
/// Contains generic reactor code.  Currently, this only contains stuff that corrects
/// various problems with DIMSCALE, LTSCALE, etc.  This command can be run from the
/// NETLOAD command while loading the DLL.
/// </summary>
public class Reactors
{
private static bool dimstyleChanged = false;
private static bool fixscalesEnabled = false;
public Reactors()
{
}

[CommandMethod("FIXSCALES")]
public void EnableFixscales()
{
if (!fixscalesEnabled) {
ACAD.Application.SystemVariableChanged += new ACAD.SystemVariableChangedEventHandler(SystemVariableChanged);
fixscalesEnabled = true;
}
}

[CommandMethod("UNFIXSCALES")]
public void DisableFixscales()
{
if (fixscalesEnabled) {
ACAD.Application.SystemVariableChanged -= new ACAD.SystemVariableChangedEventHandler(SystemVariableChanged);
fixscalesEnabled = false;
}
}

public void SystemVariableChanged(object o, ACAD.SystemVariableChangedEventArgs e)
{
try {
// Editor ed = ACAD.Application.DocumentManager.MdiActiveDocument.Editor;
// ed.WriteMessage("\nSystem Variable changed:  {0}", e.Name);
if (e.Name.Equals("TILEMODE")) {
// user changed from paperspace to modelspace or vice-versa
Database db = ACAD.Application.DocumentManager.MdiActiveDocument.Database;
if (db.TileMode == false) {
// Paperspace
db.Dimscale = 0;
db.Ltscale = 1;
db.Psltscale = true;
} else {
// Modelspace
C3DUtil c3dUtil = new C3DUtil();
double drScale = c3dUtil.AeccDb.Settings.DrawingSettings.UnitZoneSettings.DrawingScale;
db.Dimscale = drScale;
db.Ltscale = drScale;
db.Psltscale = false;
}
}
// Fix DIMSCALE.  This is a bit convoluted, but I had to do this to make it work.
// Basically, after the DIMSTYLE is changed, Autocad will attempt to reset DIMSCALE to 1.
// But it does this *after* changing the DIMSTYLE, and if the DIMSCALE is already 1, then
// it does nothing.  So, in order to get a consistent response from Autocad, we first set
// the DIMSCALE to what we want.  Autocad will then reset it to 1, at which time we again
// set the DIMSCALE to what we want.  This time it will stay.  We use the "dimstyleChanged"
// static variable to keep track of what's going on, since this event handler ends up
// being called multiple times.  End result is that DIMSCALE = DRAWING SCALE in modelspace,
// and DIMSCALE = 0 in paperspace.
if (e.Name.Equals("DIMSTYLE")) {
// this part gets run after user sets new DIMSTYLE
changeScales();
dimstyleChanged = true;
}
if (dimstyleChanged && e.Name.Equals("DIMSCALE")) {
// after Autocad resets the DIMSCALE back to 1, this part gets run
dimstyleChanged = false;
changeScales();
}
}
catch {}
}

private void changeScales()
{
Database db = ACAD.Application.DocumentManager.MdiActiveDocument.Database;
if (db.TileMode == false) {
// Paperspace
db.Dimscale = 0;
} else {
// Modelspace
C3DUtil c3dUtil = new C3DUtil();
double drScale = c3dUtil.AeccDb.Settings.DrawingSettings.UnitZoneSettings.DrawingScale;
db.Dimscale = drScale;
}
}
}
}
« Last Edit: March 25, 2007, 03:25:35 PM by sinc »