TheSwamp

CAD Forums => CAD General => Topic started by: TJAM51 on August 19, 2004, 08:17:38 AM

Title: Scaling up
Post by: TJAM51 on August 19, 2004, 08:17:38 AM
I work for a company that does not use paper space and probably never will. We draw everything to scale. If I had a detail that needed to be drawn four times larger for clarity. I would like to be able to run a routine that could allow me to draw by inputting actual real distances but it draws at the specified scale rather than draw and scale up the required scale factor. This would be great especially having to go back and change existing details.

Thanks
Title: Scaling up
Post by: daron on August 19, 2004, 08:22:12 AM
Being that this is the cad general area, I'll answer what comes to mind sans lisp. If you have a group of objects or a single object and you want to scale it up four times what it currently is type 4 in the proper place when the scale command asks for it. If you have a length of an object and you want that object to be a specific length greater or less than what it currently is, when you see Reference on the command line, type R, tell the original length and then tell the desired length. At least that is what it sounds like you're asking for.
Title: Scaling up
Post by: TJAM51 on August 19, 2004, 08:27:30 AM
I am setting up a detail that is four times the size required. I would like to be able to run a routine that asks for the scale factor. For example 4. When this happens I draw a line that is in real life 12" but the line is physically drawn at 48" based upon the routine or variable set. This does not apply very well when drawing a new routine but it realy helps when I have to modify an existing detail. Does this make sense......


Thanks
Title: Scaling up
Post by: TJAM51 on August 19, 2004, 08:30:03 AM
One more thing all my dimensions will not be nice and even like 12" or 48". They may be 13.333 or the like.
Title: Scaling up
Post by: hendie on August 19, 2004, 08:36:56 AM
:horror:



I can see all sorts of problems with something like that. you would either need to run the routine with each command or run it for a batch of commands, so you would need a "start" mark and an "end" mark. ~ what if you forgot to turn it off ?
it would be simpler just to draw 1:1 then scale afterwards.
if need be I would have a 1:1 version on a layer somewhere (hidden/non plot) that I could use then copy and scale up as required.
Title: Scaling up
Post by: TJAM51 on August 19, 2004, 08:41:38 AM
Fair enough.


Thanks
Title: Scaling up
Post by: daron on August 19, 2004, 08:44:47 AM
Good call Hendie. Also, if you're talking dimensions and you want a 4' line to measure at 12" set dimlfac variable to .25. This way you don't have to override the dimension. You could have a dimstyle for details that sets it to .25 as a standard, but then, unless you override the dimstyle, it could only be used for details that are 4 times larger than they're supposed to be.

As for having something the standard size on a non-plot layer, I'd just wblock it to a standard details folder and insert it as needed.
Title: Scaling up
Post by: hendie on August 19, 2004, 08:44:55 AM
sorry I can't think of a better or more efficient way. Perhaps someone else here will have an idea
Title: Scaling up
Post by: hendie on August 19, 2004, 09:05:28 AM
on further thinking... what you have just described seems to me to be the perfect argument for moving to using layouts/paperspace.

why don't you time yourself doing a "standard" drawing, details etc, then do the same drawing again but without the scaling nonsense and use viewports instead ?
show them how much easier/faster it is to complete any modifications, plus all your dimensions are the correct size !
Title: Scaling up
Post by: AVCAD on August 19, 2004, 10:17:59 AM
YA....really, uh...this may be stupid...but why dont you just draw it to scale, say you want the dimension from floor to ceiling (if you are doing an elevation) 10' then just drawing 10'

Then when you have completed the elevation just scale everything by 4...

shit for that matter use PAPERSPACE!!! and use a viewport this way you can draw it to scale and just scale the viewport to view it larger.

Seems like a pretty easy this to do...if you dont use paperspace like you said....just scale everything by 4 and be done with it...by do it this way you are taking away the scale factor anyways so shit scale it by 100 if you want....or you can scale it by 25.4 and tell them to use metric!!!

 :shock:
Title: Re: Scaling up
Post by: CADaver on August 19, 2004, 12:48:01 PM
Quote from: TJAM51
I work for a company that does not use paper space and probably never will.
Then anything you do is going to be difficult, slow, and probably less than accurate.

Quote from: TJAM51
I would like to be able to run a routine that could allow me to draw by inputting actual real distances but it draws at the specified scale rather than draw and scale up the required scale factor.
That's called draw to scale and use paperspace

Quote from: TJAM51
This would be great especially having to go back and change existing details.
Yes paperspace is great, and simple.  Why not just use the tool?
Title: Scaling up
Post by: Dent Cermak on August 19, 2004, 01:02:42 PM
This works. I stole...........er, borrowed...........er, got this from "Hot Tip Harry". I use it all the time.



;DETAIL.LSP

; Purpose: To make a circular detail from part of a drawing and trim parts of
; entities outside detail.

; Before running the routine, draw a circle around the section to be detailed
; and a circle to put the detail into. The routine will prompt you to pick the
; source and destination circles, and does the rest for you. The two circles
; can be different sizes.

; You are given the option to copy text into the detail, to scale any text
; which does get copied and to scale pline widths. The finished detail can be
; wblocked to an external file. Attributes may be turned into text, in order
; to save their values and any attedit changes.

; Detail.lsp is able to trim every entity, except minserts, blocks with unequal
; scales and text or shapes. Plines with width will lose their linetype and
; become continuous. Some entities (ie. solids) get trimmed along the circle
; with line segment approximations. Their accuracy is controlled by the system
; variable SPLINESEGS. For my purposes, it is the # of line segments in a 45
; degree arc.

;   written by: Len Switzer
;      Upper Canada Software
;      222 Monteith Ave.
;      Stratford, Ont., Canada
;      N5A 2P6
;      (519) 271-1019

(prompt"\nLoading detail.lsp...")

(defun C:DETAIL( / CENTER CIR1 CIR2 ENT ENT2 ENTLST FH FLAGS PLINES RADIUS
         SCALE SKIPSS SS STR SYSLST TEXT)

  (SYSVAR"CMDECHO"0)
  (SYSVAR"HIGHLIGHT"0)
  (SYSVAR"BLIPMODE"0)

  (while(or(null(setq CIR1(entsel"\nPick source circle: ")))
     (/=(cdr(assoc 0(setq CIR1(entget(car CIR1)))))"CIRCLE")))

  (while(or(null(setq CIR2(entsel"\nPick destination circle: ")))
     (/=(cdr(assoc 0(setq CIR2(entget(car CIR2)))))"CIRCLE")))


  (setq RADIUS(cdr(assoc 40 CIR2))
   CENTER(cdr(assoc 10 CIR2))

   ;Find all entities in source circle.
   SS(ssget"C"(mapcar'(lambda(PT1)(- PT1(cdr(assoc 40 CIR1))))
           (cdr(assoc 10 CIR1)))
         (mapcar'(lambda(PT1)(+ PT1(cdr(assoc 40 CIR1))))
           (cdr(assoc 10 CIR1))))

   ENTLST(entlast)
   ENT ENTLST)

  ;Remove source circle & copy entities to destination circle.
  (ssdel(cdr(assoc -1 CIR1))SS)
  (command".COPY"SS""(cdr(assoc 10 CIR1))CENTER)

  ;Make a selection set of new entities.
  (setq SS(ssadd))
  (while(setq ENT(entnext ENT))
    (ssadd ENT SS))

  ;Scale new entities to fit destination circle.
  (setq SCALE(/ RADIUS(cdr(assoc 40 CIR1))))
  (if(/= SCALE 1.0)
    (command".SCALE"SS""CENTER SCALE))

  ;Bit flags: Delete source circle/Wblock/Scale text.
  (setq FLAGS 0)

  (initget"Yes No")
  (if(eq(getkword"\nCopy text into detail? <No>: ")"Yes")
    (progn
      (prompt"\nSelect text to copy or <All>:")
      (if(null(setq TEXT(ssget)))
   (setq TEXT T))
      (initget"Yes No")
      (if(eq(getkword"\nScale text to fit detail? <No>: ")"Yes")
   (setq FLAGS(logior FLAGS 4)))))

  (initget"Yes No")
  (if(eq(getkword"\nScale pline width to fit detail? <No>: ")"Yes")
    (progn
      (prompt"\nSelect plines for width scaling or <All>:")
      (if(null(setq PLINES(ssget)))
   (setq PLINES T))))

  (initget"Yes No")
  (if(/=(getkword"\nDelete source circle? <Yes>: ")"No")
    (setq FLAGS(logior FLAGS 1)))

  (initget"Yes No")
  (if(eq(getkword"\nWblock detail? <No>: ")"Yes")
    (while
      (progn
   (setq FLAGS(logior FLAGS 2)
         STR(strcase(getstring"\nEnter file name: ")))
   (if(setq FH(open(strcat STR".DWG")"r"))
     (progn(setq FH(close FH))
       (initget"Yes No")
       (eq(getkword(strcat"\n"STR".DWG exists. Overwrite? <Yes>: "))"No"))
     (if(setq FH(open(strcat STR".DWG")"a"))
       (setq FH(close FH))
       (null(prompt(strcat"\nCan't open "STR".DWG for write."))))))))

  (if(eq PLINES T)
    (setq PLINES SS))
  (if(eq TEXT T)
    (setq TEXT SS))

  ;delete source circle?
  (if(eq(logand FLAGS 1)1)
    (entdel(cdr(assoc -1 CIR1))))

  (setq ENT(entget ENTLST)SS nil SKIPSS(ssadd))

    ;Start off trim command.
  (command".TRIM"(cdr(assoc -1 CIR2))"")


  ;Main loop.

  ;Process each new entity, unless it's in SKIPSS. The trim command is used
  ;for lines, circles and arcs, and is maintained as the current command
  ;throughout the routine. It's very important to not go nuts trimming things
  ;at any old point. Everything must only be trimmed outside the detail. Lines
  ;and arcs may need to be trimmed once or twice, circles may need one. Any
  ;entities entirely outside the detail are deleted.

  ;Blocks, dimensions, 3d-meshes and zero width plines are exploded into their
  ;component parts. Attributes may be turned into text, in order to save their
  ;value and any attedit changes.

  ;The Lisp War Rules were very clear that the routine should handle solids
  ;and pline widths. These two features are much more difficult than the rest
  ;of the program put together!! But, after some work, I came up with nice
  ;algorithms to implement these features. The solid routine will trim solids,
  ;traces and 3d-faces. It is very robust, and will handle any solid which
  ;gets copied to the detail. It does these entities in one pass, and generates
  ;as few extra entities as possible. These entities may need to be broken into
  ;several pieces, and they may need to have a wedge (bounded by an edge and an
  ;arc) filled with smaller solids or 3d-faces. Plines with width are turned
  ;into multiple solids.

  ;An even harder challenge is to trim pline widths. This is very, very hard.
  ;I decided to tackle it...by cheating!! I break up plines with width into
  ;multiple solids, (not trivial, mind you) and then pass them through the
  ;solid algorithm. Problem solved. Beauty!!

  (while
    ;Grab next entity to process, missing the ones in SKIPSS.
    (progn
      (while(and(setq ENT(entnext(cdr(assoc -1 ENT))))
         (ssmemb ENT SKIPSS)
         (setq ENT(entget ENT))))
      ENT)

    (redraw ENT 3)
    (setq ENT(entget ENT))

    ;*Every* entity type will get processed.

    (eval
      (cdr(assoc(cdr(assoc 0 ENT))
       (list
         (cons"LINE"'(D_LINE))

         (cons"3DLINE"'(D_LINE))

         (cons"CIRCLE"'(D_CIRCLE))

         (cons"ARC"'(D_ARC))

         (cons"POINT"
           '((lambda()
        (if(>(distance(cdr(assoc 10 ENT))CENTER)RADIUS);Point outside circle?
          (entdel(cdr(assoc -1 ENT)))))))

         (cons"DIMENSION"
           '((lambda()
        (setq ENT2(if(eq(type TEXT)'PICKSET)
              (entget(entlast))))
        (EXPLODE_ENT)

        ;Save any text from being processed.
        (if ENT2
          (while(and(setq ENT2(entnext(cdr(assoc -1 ENT2))))
             (setq ENT2(entget ENT2))
             (/=(cdr(assoc 0 ENT2))"TEXT"))))
        (if ENT2
          (ssadd(cdr(assoc -1 ENT2))SKIPSS)))))

         (cons"INSERT"'(D_INSERT))

         (cons"ATTDEF"
           '((lambda()
        (if(zerop(logand FLAGS 4))
          (entmod(subst(cons 40(/(cdr(assoc 40 ENT))SCALE))
            (assoc 40 ENT)ENT))))))

         (cons"TEXT"'(D_TEXT))

         (cons"SHAPE"'(D_TEXT))

         (cons"3DFACE"'(TEST_SOLID T))

         (cons"SOLID"'(TEST_SOLID nil))

         (cons"TRACE"'(TEST_SOLID nil))

         (cons"POLYLINE"'(D_PLINE))))))

    (if ENT
      (redraw(cdr(assoc -1 ENT))4)))

  (command)

  (if(eq(logand FLAGS 2)2)
    (progn
      (prompt(strcat"\nWblocking detail to "STR"...."))
      (command".WBLOCK" STR)
      (if(setq FH(open(strcat STR".DWG")"r"))
   (progn(setq FH(close FH))
     (command"Yes")))
      (command "" CENTER)
      (while(setq ENTLST(entnext ENTLST))
   (command ENTLST))
      (command"")))

  (SYSVAR nil nil)
  (redraw(cdr(assoc -1 CIR2))4)

  (prompt"\nDone.")
  (princ))

(prompt".")

;Functions used by C:DETAIL.

;May need to trim one or both ends of a line.
(defun D_LINE()
  ;One end outside detail?
  (if(>=(distance(cdr(assoc 10 ENT))CENTER)RADIUS)
    ;Both ends outside detail?
    (if(>=(distance(cdr(assoc 11 ENT))CENTER)RADIUS)
      ;Entire line outside detail?
      (if(CLOSEST(cdr(assoc 10 ENT))(cdr(assoc 11 ENT)))
   ;Trim both ends.
   (command(list(cdr(assoc -1 ENT))(cdr(assoc 10 ENT)))
     (list(cdr(assoc -1 ENT))(cdr(assoc 11 ENT))))
   ;Delete line.
   (entdel(cdr(assoc -1 ENT))))
      ;Trim one end.
      (command(list(cdr(assoc -1 ENT))(cdr(assoc 10 ENT)))))
    ;Other end outside detail?
    (if(>=(distance(cdr(assoc 11 ENT))CENTER)RADIUS)
      ;Trim other end.
      (command(list(cdr(assoc -1 ENT))(cdr(assoc 11 ENT)))))))

;May need to trim circle once or delete it.
(defun D_CIRCLE( / PT1)
  ;Is the point on the circle closest to the detail center, outside?
  (if(>=(distance
     (polar(cdr(assoc 10 ENT))
       (angle(cdr(assoc 10 ENT))CENTER)
       (cdr(assoc 40 ENT)))
     CENTER)
       RADIUS)
    ;Delete circle.
    (entdel(cdr(assoc -1 ENT)))
    ;Is the point on the circle farthest from the detail center, outside?
    (if(>=(distance
      (setq PT1(polar(cdr(assoc 10 ENT))
            (angle CENTER(cdr(assoc 10 ENT)))
            (cdr(assoc 40 ENT))))
      CENTER)
    RADIUS)
      ;Trim circle.
      (command(list(cdr(assoc -1 ENT))PT1)))))

(prompt".")

;May need to trim one or both ends of arc.
(defun D_ARC( / PT1 PT2)
  ;Endpoints of arc.
  (setq PT1(polar(cdr(assoc 10 ENT))(cdr(assoc 50 ENT))(cdr(assoc 40 ENT)))
   PT2(polar(cdr(assoc 10 ENT))(cdr(assoc 51 ENT))(cdr(assoc 40 ENT))))
  ;One endpoint outside detail?
  (if(>=(distance PT1 CENTER)RADIUS)
    ;Other end outside detail?
    (if(>=(distance PT2 CENTER)RADIUS)
      (progn
   ;Trim both ends of arc.
   (command(list(cdr(assoc -1 ENT))PT1)(list(cdr(assoc -1 ENT))PT2))
   ;If arc is unchanged, delete it.
   (if(equal ENT(entget(cdr(assoc -1 ENT))))
     (entdel(cdr(assoc -1 ENT)))))
      ;Trim one end.
      (command(list(cdr(assoc -1 ENT))PT1)))
    ;Other end outside detail?
    (if(>=(distance PT2 CENTER)RADIUS)
      ;Trim other end.
      (command(list(cdr(assoc -1 ENT))PT2))
      ;Both ends are inside detail.
      ;Trim point on arc farthest from detail center, just in case.
      (command(list(cdr(assoc -1 ENT))
      (polar(cdr(assoc 10 ENT))
        (angle CENTER(cdr(assoc 10 ENT)))
        RADIUS))))))

(defun D_TEXT()
  (if(or(null TEXT)
       (not(ssmemb(cdr(assoc -1 ENT))TEXT)))
    (entdel(cdr(assoc -1 ENT)))
    (if(zerop(logand FLAGS 4))
      (entmod(subst(cons 40(/(cdr(assoc 40 ENT))SCALE))
   (assoc 40 ENT)ENT)))))

(prompt".")

;Explode block. If there are attributes, offer to save their values as text.
(defun D_INSERT( / MODE TEMP)
  (cond
    ((not(=(cdr(assoc 41 ENT))(cdr(assoc 42 ENT))(cdr(assoc 43 ENT))))
      (prompt"\nCan't explode block with unequal scales."))
    ((and(assoc 66 ENT)
       (eq(logand(cdr(assoc 66 ENT))1)1)
       (progn
    (redraw(cdr(assoc -1 ENT))3)
    (initget"Yes No")
    (command"")
    (/=(getkword"\nBlock has attributes. Save attribute values as text? <Yes>: ")
      "No"))
   (setq MODE T)
   (ATT2TEXT)
   nil))
    ((setq TEMP(entlast))
      (EXPLODE_ENT)
      (if(and(assoc 66 ENT)
      (eq(logand(cdr(assoc 66 ENT))1)1)
      (null MODE)
      (null(initget"Yes No"))
      (eq(getkword"\nDelete attribute definitions? <Yes>: ")"No"))
   (setq TEMP(entlast)))
      (while(setq TEMP(entnext TEMP))
   (if(eq(cdr(assoc 0(entget TEMP)))"ATTDEF")
     (entdel TEMP)))
      (REDRAW_SS))))

(defun EXPLODE_ENT()
  (command)
  (command".EXPLODE"(cdr(assoc -1 ENT))".TRIM"(cdr(assoc -1 CIR2))""))

;Turn a block's attributes into text.
(defun ATT2TEXT()
  (if(/=(type SS)'PICKSET)
    (setq SS(ssadd)))
  (while(/=(cdr(assoc 0(setq ENT(entget(entnext(cdr(assoc -1 ENT)))))))
     "SEQEND")
    (command".TEXT"(getvar"VIEWCTR")"" "" "%%u")
    (ssadd(entlast)SS)
    (ssadd(entlast)SKIPSS)
    (if(zerop(logand FLAGS 4))
      (setq ENT(subst(cons 40(/(cdr(assoc 40 ENT))SCALE))
        (assoc 40 ENT)ENT)))
    (COPY_PROPS
      (LIST_PROPS'(1 6 7 8 10 11 38 39 40 41 50 51 62 71 72 230))
      (entget(entlast))))
  (setq ENT(entget(cdr(assoc -2 ENT)))))

(prompt".")

;Find intersection between circle and line.
;PT1 is outside circle, PT2 is inside.
(defun CIRCLE_LINE(PT1 PT2 / TEMP TEMP2)
  (setq TEMP(inters PT1 PT2
         CENTER(polar CENTER(+(angle PT1 PT2)(* pi 0.5))1.0)
         nil)
   TEMP2(distance CENTER TEMP))
  (polar TEMP
    (angle PT2 PT1)
    (sqrt(-(* RADIUS RADIUS)(* TEMP2 TEMP2)))))

;Return point closest to detail center, or nil if it's outside detail.
(defun CLOSEST(PT1 PT2)
  (inters PT1 PT2
    (polar CENTER(+(angle PT1 PT2)(* pi 0.5))RADIUS)
    (polar CENTER(-(angle PT1 PT2)(* pi 0.5))RADIUS)))

(defun REDRAW_SS( / ENT)
  (if(eq(type SS)'PICKSET)
    (while(setq ENT(ssname SS 0))
      (redraw ENT 1)
      (ssdel ENT SS)))
  (setq SS nil))

;Return list of property values from ENT for each GROUP in LST1.
(defun LIST_PROPS(LST1)
  (mapcar'(lambda(GROUP)(assoc GROUP ENT))
    LST1))

;Copy properties passed in LST1, into ENT.
(defun COPY_PROPS(LST1 ENT / TEMP)
  (foreach GROUP LST1
    (if GROUP
      (setq ENT
   (if(setq TEMP(assoc(car GROUP)ENT))
     (subst GROUP TEMP ENT)
     (cons GROUP ENT)))))
  (entmod ENT))

(prompt".")

;My standard system variable routine.
;Uses SYSLST to store old settings.
(defun SYSVAR(SYM MODE)
  (cond
    (MODE
      (if(assoc SYM SYSLST)
   (if(null(cdr(assoc SYM SYSLST)))
     (setq SYSLST(subst(cons SYM(getvar SYM))(cons SYM nil)SYSLST)))
   (setq SYSLST(cons(cons SYM(getvar SYM))SYSLST)))
      (setvar SYM MODE))
    (SYM
      (if(and(setq MODE(assoc SYM SYSLST))(cdr MODE))
   (progn(setvar SYM(cdr MODE))
     (setq SYSLST(subst(cons SYM nil)MODE SYSLST)))))
    (T(foreach MODE SYSLST
   (if(cdr MODE)(setvar(car MODE)(cdr MODE))))
      (setq SYSLST nil))))


;The rest of the routine is used for the solid and wide pline features.

;Trim a solid, trace or 3d-face.
;MODE is T for a 3d-face, nil for a solid or trace.
;It's needed because the meaning of groups 12 & 13 are switched.
(defun TEST_SOLID(MODE / LST3)

  ;Build LST3 with outside/inside flag for each corner.
  (foreach PT1(if MODE '(13 12 11 10) '(12 13 11 10))
    (setq LST3(cons(>(distance(cdr(assoc PT1 ENT))CENTER)
           RADIUS)
      LST3)))

  ;Is solid not entirely inside detail?
  (if(not(equal LST3'(nil nil nil nil)))
    (TEST_SOLID2)))

(defun TEST_SOLID2( / CNT LST1 LST2 TEMP)
  (setq LST2(if MODE '(10 11 12 13 10 11) '(10 11 13 12 10 11))
   LST3(append LST3(list(car LST3)))
   CNT 0)

  ;Examine each edge. Build LST1 with every corner needed to define the new
  ;polygon. The corners could be endpoints of ENT, or intersections between
  ;an edge and the circle. As many new corners as neccessary are added to LST1.
  ;If an edge passes outside the detail, a wedge is needed. The value nil is
  ;added to flag the need for a wedge fill between two corners.
  (repeat 4
    (if(null(nth CNT LST3));Is corner inside detail?
      (progn
   (setq LST1(cons(cdr(assoc(nth CNT LST2)ENT))LST1));Add corner to LST1.
   (if(nth(1+ CNT)LST3);Is next corner outside detail?
     ;Add single intersection between edge and circle.
     (setq LST1(cons nil
            (cons(CIRCLE_LINE
              (cdr(assoc(nth(1+ CNT)LST2)ENT))
              (cdr(assoc(nth CNT LST2)ENT)))
         LST1)))))
      (if(nth(1+ CNT)LST3);Is next corner also outside circle?
   ;Does edge intersect with circle?
   (if(setq TEMP(CLOSEST(cdr(assoc(nth CNT LST2)ENT))
             (cdr(assoc(nth(1+ CNT)LST2)ENT))))
     ;Add two intersections to LST1.
     (setq LST1(append(list nil
              (CIRCLE_LINE
                (cdr(assoc(nth(1+ CNT)LST2)ENT))
                TEMP)
              (CIRCLE_LINE
                (cdr(assoc(nth CNT LST2)ENT))
                TEMP))LST1)))
   ;Add single intersection to LST1.
   (setq LST1(cons(CIRCLE_LINE
          (cdr(assoc(nth CNT LST2)ENT))
          (cdr(assoc(nth(1+ CNT)LST2)ENT)))
          LST1))))
    (setq CNT(1+ CNT)))

  ;Is solid not entirely outside detail?
  (if LST1
    (TRIM_SOLID)
    (entdel(cdr(assoc -1 ENT)))))

(prompt".")

(defun TRIM_SOLID( / PT1 SS2)
  (setq LST1(append(list(last LST1))LST1)
   LST2 nil LST3 nil CNT -1)

  ;Build LST3 with ordered coords for a single solid.
  ;Build LST2 with complete sets of coords for each solid.
  (repeat(1-(length LST1))
    (if(setq PT1(nth(setq CNT(1+ CNT))LST1));Corner?
      (if(eq(length(setq LST3(cons PT1 LST3)))4);Is LST3 complete?
   (setq LST2(cons LST3 LST2);Add LST3 to LST2.
         ;Initialize LST3 for next solid. Neighbouring solids share an edge.
         LST3(list PT1(last LST3))))

      ;Fill a wedge between last & next corners.
      (WEDGE(nth(1- CNT)LST1)(nth(1+ CNT)LST1))))

  (setq SS2 SS SS nil)
  (if(eq(length LST3)3)
    (setq LST2(cons(cons(car LST3)LST3)LST2)))
  (COPY_SOLID(length LST2));Generate needed # of solids.
  (setq LST3(if MODE '(10 11 12 13) '(10 11 13 12))
   CNT -1)

  ;Copy new corners into new entities.
  (foreach LST1 LST2
    (setq ENT2(entget(ssname SS(setq CNT(1+ CNT)))))
    (ssadd(cdr(assoc -1 ENT2))SKIPSS)
    (COPY_PROPS
      (append(mapcar 'cons LST3 LST1)
   (list(assoc 6 ENT)(assoc 8 ENT)(assoc 38 ENT)
     (assoc 39 ENT)(assoc 62 ENT)(assoc 210 ENT)))
      ENT2))

  (REDRAW_SS)
  (setq SS SS2 SS2 nil)
  (REDRAW_SS))

(defun D_PLINE( / ENT2 ENTLST LST1 MODE)
  (cond

    ;3d-mesh?
    ((eq(logand(cdr(assoc 70 ENT))16)16)
      (EXPLODE_ENT))

    ;Are there no widths?
    ((progn
       (while(and(/=(cdr(assoc 0(setq ENT(entget(entnext(cdr(assoc -1 ENT)))))))
         "SEQEND")
          (=(cdr(assoc 40 ENT))(cdr(assoc 41 ENT))0.0)))
       (eq(cdr(assoc 0 ENT))"SEQEND"))
      (setq ENT(entget(cdr(assoc -2 ENT))))
      (EXPLODE_ENT))

    ;Pline has widths, explode into solids.
    (T
      (command)

      ;Reset ENT to pline ename.
      (while(/=(cdr(assoc 0(setq ENT(entget(entnext(cdr(assoc -1 ENT)))))))
         "SEQEND"))

      ;Scale widths, if needed.
      (if(or(null PLINES)
      (not(ssmemb(cdr(assoc -2 ENT))PLINES)))
   (progn
     (setq ENT(entget(cdr(assoc -2 ENT))))
     (while(/=(cdr(assoc 0(setq ENT(entget(entnext(cdr(assoc -1 ENT)))))))
        "SEQEND")
       (entmod(subst(cons 40(/(cdr(assoc 40 ENT))SCALE))
           (assoc 40 ENT)
         (subst(cons 41(/(cdr(assoc 41 ENT))SCALE))
      (assoc 41 ENT)ENT))))
     (entupd(cdr(assoc -2 ENT)))))

      (setq ENT(entget(cdr(assoc -2 ENT)))
       ENTLST(entlast))

      ;Loop for each vertex.
      ;LST1 is used to hold the beveled coords of the 2nd last vertex,
      ;and the unbeveled coords of the last vertex.
      (while(/=(cdr(assoc 0(setq ENT(entget(entnext(cdr(assoc -1 ENT)))))))
         "SEQEND")
   (if(or(null(assoc 42 ENT))(zerop(cdr(assoc 42 ENT))));no bulge?
     (D_WP_LINE)
     (D_WP_ARC)))
      (entdel(cdr(assoc -2 ENT)))
      (while(setq ENTLST(entnext ENTLST))
   (redraw ENTLST 1))))

  (command)
  (command".TRIM"(cdr(assoc -1 CIR2))""))

(prompt".")

;Make solids from wide pline segment.
(defun D_WP_LINE( / ANG LST2 PT1 PT2)
  (if(and(setq PT1(cdr(assoc 10 ENT))
          ENT2(entget(entnext(cdr(assoc -1 ENT)))))
       (/=(cdr(assoc 0 ENT2))"SEQEND"))
    (setq PT2(cdr(assoc 10 ENT2))
     ANG(list(angle PT1 PT2)(* pi 0.5))

     ;Build LST2 with coords of unbeveled box for segment.
     LST2(mapcar
      '(lambda(PT1 SYM GROUP)
         (polar PT1
           (apply SYM ANG)
           (*(cdr(assoc GROUP ENT))0.5)))
      (list PT1 PT1 PT2 PT2)
      '(+ - + -)
      '(40 40 41 41)))
    (setq LST2 nil))

  ;Use LST2 to modify LST1.
  (if LST2
    (if LST1
      (if(BEVEL_TEST
      (D_MIDPT(car LST1)(cadr LST1))
      PT1
      PT2)

   ;Bevel.
   (setq LST1(list
          (inters(car LST1)(caddr LST1)
            (car LST2)(caddr LST2)nil)
          (inters(cadr LST1)(cadddr LST1)
            (cadr LST2)(cadddr LST2)nil)
          (caddr LST2)
          (cadddr LST2)))

   ;No bevel.
   (progn
     (command(caddr LST1)(cadddr LST1)""".SOLID")
     (setq LST1 LST2)))

      (progn
   (setq ENT2 ENT
         LST1(if(and MODE   ;Was an arc the last segment?
             (BEVEL_TEST
          (polar PT1 MODE 1.0)
          PT1
          PT2))

          ;Bevel.
          (list(inters PT1(polar PT1 MODE 1.0)
            (car LST2)(caddr LST2)nil)
            (inters PT1(polar PT1 MODE 1.0)
         (cadr LST2)(cadddr LST2)nil)
            (caddr LST2)
            (cadddr LST2))

          ;No bevel.
          LST2)
         MODE nil)
   (command".SOLID")))
    (setq LST1(cddr LST1)))

  (command(car LST1)(cadr LST1))

  (if(/=(cdr(assoc -1 ENT))(cdr(assoc -1 ENT2)))
    (progn
      (COPY_PROPS
   (list(assoc 6 ENT2)(assoc 8 ENT2)(assoc 38 ENT2)
     (assoc 39 ENT2)(assoc 62 ENT2)(assoc 210 ENT2))
   (entget(entlast)))
      (setq ENT2 ENT))))

(prompt".")

;Approximate Pline arc with width using solids.
(defun D_WP_ARC( / ANG BULGE CNT PT1 PT2 PT3 RADIUS TEMP TEMP2 WIDTH WIDTH2)

  (setq PT1(cdr(assoc 10 ENT))
   PT2(cdr(assoc 10(entget(entnext(cdr(assoc -1 ENT))))))
   BULGE(cdr(assoc 42 ENT))
   PT3(polar PT1   ;Center of arc.
        (apply(if(minusp BULGE)'-'+)
          (list(angle PT1 PT2)
       (-(* pi 0.5)(*(atan(abs BULGE))2))))
        (/(distance PT1 PT2)
          (sin(*(atan(abs BULGE))2))2))
   RADIUS(distance PT1 PT3)
   BULGE(* 4(atan BULGE))
   CNT(fix(abs(/(* BULGE 4(getvar"SPLINESEGS"))pi)))
   TEMP(/ BULGE CNT);Angle increment
   WIDTH(*(cdr(assoc 40 ENT))0.5)
   WIDTH2(*(cdr(assoc 41 ENT))0.5))
  (if(> WIDTH RADIUS)
    (setq WIDTH RADIUS))
  (if(> WIDTH2 RADIUS)
    (setq WIDTH2 RADIUS))
  (setq TEMP2(/(- WIDTH2 WIDTH)CNT);Width increment.
   ANG(angle PT3 PT1))

  ;May need to finish off last line segment before making arc.
  (if LST1
    (progn
      (if(BEVEL_TEST
      (D_MIDPT(car LST1)(caddr LST1))
      PT1
      (polar PT1 ANG 1.0))
   (command
     (inters(car LST1)(caddr LST1)
       PT3(polar PT3 ANG 1.0)nil)
     (inters(cadr LST1)(cadddr LST1)
       PT3(polar PT3 ANG 1.0)nil))
   (command(caddr LST1)(cadddr LST1)))
      (if ENT2
   (COPY_PROPS
     (list(assoc 6 ENT2)(assoc 8 ENT2)(assoc 38 ENT2)
       (assoc 39 ENT2)(assoc 62 ENT2)(assoc 210 ENT2))
     (entget(entlast))))
      (setq LST1 nil)))

  (command)
  (command ".SOLID")

  (if(> CNT 1)
    (progn
      (setq LST1(LIST_PROPS'(6 8 38 39 62 210)))
      (command(polar PT3(angle PT3 PT1)(+ RADIUS WIDTH))
   (polar PT3(angle PT3 PT1)(- RADIUS WIDTH)))
      (repeat CNT
   (setq ANG(+ ANG TEMP)
         WIDTH(+ WIDTH TEMP2))
   (command(polar PT3 ANG (+ RADIUS WIDTH))
     (polar PT3 ANG (- RADIUS WIDTH)))
   (COPY_PROPS LST1 (entget(entlast))))
      (setq LST1 nil)))

  (command"")


  (setq MODE(angle PT3 PT2)))

(prompt".")

;Fill a wedge bounded by an arc and a line with several solids or 3d-faces.
(defun WEDGE(PT1 PT2 / ANG CNT ENT2 LST1 LST2 PT3 TEMP)

  ;Figure # of segments needed to fill the wedge. I use the coord length & trig
  ;to avoid quadrant messes when dealing with angles.
  (setq CNT(fix(abs(/(*(ASIN(/(distance PT1 PT2)2 RADIUS))
             8
             (getvar"SPLINESEGS"))
           pi))))
  (if(> CNT 1)
    (progn
      (setq ENT2(entlast)
       TEMP(/(*(ASIN(/(distance PT1 PT2)RADIUS 2))2)CNT)
       ;Figure starting angle. Again, use trig to avoid quadrant hassles.
       ANG(-(angle CENTER(D_MIDPT PT1 PT2))
       (ASIN(/(distance PT1 PT2)2 RADIUS))))

      (command)
      (command(if MODE ".3DFACE" ".SOLID"))

      ;LST1 & LST2 will be alternated when supplying points to the command.
      ;This lets me account for the different point orders of solids & 3dfaces.
      (setq LST1'((inters CENTER(setq PT3(polar CENTER ANG RADIUS))
          PT1 PT2 nil)
          PT3)
       LST2(if MODE
        '((setq PT3(polar CENTER ANG RADIUS))
           (inters CENTER PT3 PT1 PT2 nil))
        '((inters CENTER(setq PT3(polar CENTER ANG RADIUS))
            PT1 PT2 nil)
            PT3)))

      ;Make wedge.
      (repeat(1+ CNT)
   (apply'command(mapcar'eval(if(minusp CNT)LST2 LST1)))
   (setq ANG(+ ANG TEMP)CNT(* CNT -1)))
      (command)
      (if(/=(type SS)'PICKSET)
   (setq SS(ssadd)))
      (setq TEMP(LIST_PROPS'(6 8 38 39 62 210))
       CNT 1)

      ;Copy ENT's properties to wedge.
      (while(setq ENT2(entnext ENT2))
   (ssadd ENT2 SKIPSS)
   (ssadd ENT2 SS)
   (COPY_PROPS
     (if MODE
       (if(minusp CNT)
         (cons'(70 . 7)TEMP)
         (cons'(70 . 13)TEMP))
       TEMP)
     (entget ENT2))
   (setq CNT(* CNT -1)))
      (command".TRIM"(cdr(assoc -1 CIR2))""))))

;Create new solids or 3d-faces, to be modified later.
(defun COPY_SOLID(CNT / TEMP)
  (setq TEMP(getvar"VIEWCTR"))
  (if(/=(type SS)'PICKSET)
    (setq SS(ssadd)))
  (command)
  (command(if(eq(cdr(assoc 0 ENT))"3DFACE")".3DFACE"".SOLID")TEMP TEMP)
  (repeat CNT
    (command TEMP TEMP)
    (ssadd(entlast)SS))
  (command""".TRIM"(cdr(assoc -1 CIR2))"")
  (entdel(cdr(assoc -1 ENT))))

(defun ASIN(ANG)
  (atan(/ ANG(sqrt(abs(- 1(* ANG ANG)))))))

;Test plines with width to see if a bevel is needed.
(defun BEVEL_TEST(PT1 PT2 PT3)
  (>(/(*(ASIN(/(distance PT1(polar PT2(angle PT2 PT3)(distance PT1 PT2)))
          (*(distance PT1 PT2)2)))
   360)pi)
    29.955))

(defun D_MIDPT(PT1 PT2)
  (mapcar'(lambda(PT1 PT2)(/(+ PT1 PT2)2))
    PT1 PT2))

(prompt"Done.")
(princ)





Just another case of where lisp is the answer.
Title: Scaling up
Post by: TJAM51 on August 19, 2004, 01:32:43 PM
Ok....I need to explain sumthin........first of all companies will dictate whether or not model space and paper space are used...not me. I am an employee. Individual employees are not allowed to set policy, teams are and if the cad team or the engineering team says no paper space then the law has been set. I always draw to scale and will have to scale up if need be whether I use the scale command or use a routine that does some form of scaling for me. My hinderance comes when I revise existing details that are to a larger scale such as 4 times, etc. If I revise I need to scale down again and then modify as needed then scale back up again. I only seek a simple method where I might pick a button once to start and once to reset all back to normal.
Title: Scaling up
Post by: t-bear on August 19, 2004, 01:45:33 PM
Y'gotta forgive these guys, TJAM51.  It's kinda like when you quit smokin' or get saved.....suddenly it's "the only way".....
We use MS/PS here and have since I don't remember when so I'm unable to help you....sorry.  If a lisp can be made to do what you need, Mark, Keith or Paul could pro'lly figure one out.  "course with my skimpy knowledge of lisp, I ain't all that sure it CAN!  Cross your fingers -n- hope one of 'em takes it as a challenge.
Title: Scaling up
Post by: ELOQUINTET on August 19, 2004, 01:52:47 PM
fire the person in charge of making policies at your office he's counter productive. by the way shouldn't this really be moved to cad standards at this point  :roll:
Title: Scaling up
Post by: CADaver on August 19, 2004, 03:46:35 PM
Quote from: TJAM51
Ok....I need to explain sumthin........first of all companies will dictate whether or not model space and paper space are used...not me. I am an employee. Individual employees are not allowed to set policy, teams are and if the cad team or the engineering team says no paper space then the law has been set.
Maybe It's time to seek intelligent employment.  If your "team" has set an unintelligent policy (and this is just that), as a conscientious employee it's up to you to challege such a time wasting policy.
Title: Scaling up
Post by: Crank on August 19, 2004, 03:59:22 PM
Years ago, I worked at a firm were they used a XREF for every scale. Every XREF was inserted with a different scale. With some fuctions you could quickly switch between them.
It worked like a charm, but every drawing existed of several files.
Title: Scaling up
Post by: daron on August 20, 2004, 08:38:57 AM
Eloquintet, I never thought this was the place for this question. You are correct that it could be moved or split to the cad standards forum, since the original question has mutated into cad standards, but the original question hasn't been resolved. At any rate, the question was asked in cad general. It could probably be overcome via lisp or vba, but as I stated in my first post, I would not post a lisp (if I even understood where to start, as I'm still not sure I understand all that is involved with the project) being that it wasn't asked in a lisp forum. If I'm asked to move the thread by the originator of the thread to the lisp forum, I would do so and might even venture to split the cad standard portion out of it into the cad standard forum.

How's that for long winded?
Title: Scaling up
Post by: TJAM51 on August 20, 2004, 08:40:08 AM
gentlemen.....the real world is this....just because a company sets policy such as this does not mean the end of the world. This is a very imperfect world which for some reason lots of people believe that Autocad should be operated by text book procedure...not..it does not work this way. 90% of the companies do not work this way. Cad operators or techs cannot keep changing jobs because of the way a company operates it's cad dept. Sorry...this is not real world. Most of the cad operators I have seen and worked with in the past five years could not even set up a drawing without help and these operators have at least two years experience and the companies they work for and I have worked for do not wnat people who think but those who do exactly what they are told. Even the engineers dictate cad standards which creates a great deal of inconsistancy in packages. Guys to switch jobs because a techique is not practiced is not real world....I would be unemployed. The purpose of this forum is to assist in seeking solutions that are real time not speculate why a comapny is being so stupid when we all realize that is the case and we cannot change city hall's mind......yes some minds will never change.

Thanks
Title: Scaling up
Post by: hendie on August 20, 2004, 08:52:55 AM
yeah, we realise it's not a perfect world.
the problem as I see it here is that due to the methods you (company) use, any custom routine could end up causing more problems than it solves... and using the acad scale command seems to be the easiest, least problematic route to take., given your working methods.
Title: Scaling up
Post by: daron on August 20, 2004, 09:02:44 AM
TJAM, did you read the last couple of posts. I believe Mr. Crack tried to give a solution, whether it is helpful or not. He was not telling you how to run your company or your life and I, in my post was only trying to hint at the placement of your thread. I doubt you have company policy on that. As far as this real world thing goes, my last job I improved a lot of standards and was able to make the push into paperspace on a limited format. Where PS is not needed in many places, it is needed in others. I've been at my present employment for four months. When I got here I asked some questions about the standards, which at this point are horrendous <sp>.  I was told that I couldn't add layers and they were not using xref's. They do use paperspace here, which I'm surprised at. At any rate, since I've been here, I've added about 10 new layers, gotten them using xref's and am collaborating with the senior cad person on improving the standards. You talk about real world, like you're the only one living in it. I'm sorry that your's is unideal. We all live in the real world and many of us have forced change in the company we work for. You just have to lead those above you to understand that there is a better way. What I try to do is feed them about five things and hope that one will stick. I apologize for the thread mutation. See my post above.
Title: Scaling up
Post by: sinc on August 20, 2004, 09:14:18 AM
I suppose it would be possible to write some lisp that would scale an object while adding a text override to all dimensions.  This text override would contain the original dimension value.  To edit it the way you want, you'd have to rescale it back to 1:1 size, do your edits, then scale it back to your detail scale.

I'd try writing one, but I view this task as a waste of time...  Autocad has a built-in feature that does exactly this, and it's called "paperspace".

I think everyone has had experience with companies setting poor policies.  In no way are we suggesting this as a general reason for seeking a new job.  It's just that this goes beyond poor policy, or "deviation from the book".  This isn't like the "dimension in paper-space vs. model space" debate.  This is showing a rather basic misunderstanding of Autocad by whoever set that policy that is so blatant that it causes serious questions about any dealing with that company.  If the person/entity in charge is capabable of making THAT BAD a decision in this area, then what other decisions are being made at that company?  Most of us find that thought so unsettling that we'd be very uncomfortable working there...
Title: Scaling up
Post by: hendie on August 20, 2004, 09:40:15 AM
what was that famous quote.. something along the lines of
progress depends upon unreasonable people.... if no-one asks questions or rebels, the world will not progress
Title: Scaling up
Post by: andyanderson on August 20, 2004, 12:31:25 PM
Hello all:

After reading the posts on this thread, I have to chime in just a tad bit.

I used to use MS without even thinking about PS.  And yes, DETAIL.LSP is a great program in that environment.  I've used it zillions of times and it is good at what it does.

THEN I discovered PS.  With many, many thanks to T-bear and others, I graduated to PS and it's absolutely wonderful.  OK, you change the drawing in MS and it's - well - just done automatically in PS.

XREFs are a different issue.  I like to bind them when the project is done if at all possible.

Big files?  Yea, but nowadays it's not a big problem.  Use SuperPurge or something like it and with these 250GB drives and the servers available now, you'll be OK.

Now if they can just figure out how to email really big files...

And you ain't (sic) seen nuthin' yet  :)

Andy, in sunny Deland, still cleaning up the mess from Charley
Title: Scaling up
Post by: pringals on August 20, 2004, 01:57:36 PM
Quote from: sinc
I suppose it would be possible to write some lisp that would scale an object while adding a text override to all dimensions.  This text override would contain the original dimension value.  To edit it the way you want, you'd have to rescale it back to 1:1 size, do your edits, then scale it back to your detail scale.

I'd try writing one, but I view this task as a waste of time...  Autocad has a built-in feature that does exactly this, and it's called "paperspace".

I think everyone has had experience with companies setting poor policies.  In no way are we suggesting this as a general reason for seeking a new job.  It's just that this goes beyond poor policy, or "deviation from the book".  This isn't like the "dimension in paper-space vs. model space" debate.  This is showing a rather basic misunderstanding of Autocad by whoever set that policy that is so blatant that it causes serious questions about any dealing with that company.  If the person/entity in charge is capabable of making THAT BAD a decision in this area, then what other decisions are being made at that company?  Most of us find that thought so unsettling that we'd be very uncomfortable working there...


HERE HERE!!! excellent post Sinc. I was trying to figure out a nice way like that to word what I am feeling about this situation.

As I started reading this thread, I couldn't help but bang my head into my desk screaming "WHY??!!! Why must I get sooo screwed by doing the job right, yet those who half ass and "F" everything up get soo far ahead? ..."

I sympathize for you man... there is no way I could work in under those restrictions. If you know Autocad, and want to make a legitimate career with it, I suggest you start looking for another job and hit that door running.
Title: Scaling up
Post by: t-bear on August 20, 2004, 02:02:16 PM
TJAM

When I came to my present employ, the drafting dept. (3 people) had no concept of MS/PS..they didn't even use associative dims!  It took me three years of slowly picking away at these archaic "standards" but today we are firmly in the 21st century, using assoc dims, MS/PS, xrefs and all our mechanical drafting is in 3D.
Over time I introduced the use of libraries for part storage and retrieval, initiated a data base for all our parts, and a number of other "innovations", including a number of time/money saving lisp routines which, when first proposed, were met with a "no way, Jose" attitude.
It wasn't easy but I liked the company and the job.  To me it was well worth "bucking the system", something that has also had its rewards ... I'm the sr. designer here and my pay is well above what I expected to be getting when I first arrived here.  Diligence and perseverance (especially when you're RIGHT and can show 'em) do have their rewards.
I'm sorry that there is no "magic fix" for your problem.  Sometimes it just happens that way.  We (unfortunately) can't solve all of them.....  Hope you understand and are not TOO disappointed.

T-
Title: Scaling up
Post by: PDJ on August 20, 2004, 03:36:36 PM
Quote from: t-bear
TJAM

When I came to my present employ, the drafting dept. (3 people) had no concept of MS/PS..they didn't even use associative dims!  It took me three years of slowly picking away at these archaic "standards" but today we are firmly in the 21st century, using assoc dims, MS/PS, xrefs and all our mechanical drafting is in 3D.
Over time I introduced the use of libraries for part storage and retrieval, initiated a data base for all our parts, and a number of other "innovations", including a number of time/money saving lisp routines which, when first proposed, were met with a "no way, Jose" attitude.
It wasn't easy but I liked the company and the job.  To me it was well worth "bucking the system", something that has also had its rewards ... I'm the sr. designer here and my pay is well above what I expected to be getting when I first arrived here.  Diligence and perseverance (especially when you're RIGHT and can show 'em) do have their rewards.
I'm sorry that there is no "magic fix" for your problem.  Sometimes it just happens that way.  We (unfortunately) can't solve all of them.....  Hope you understand and are not TOO disappointed.

T-


What a great list of accomplishments, I'm gonna e-mail your boss and tell him to give you a pay raise to $6.00 an hour or I'm going to steal you away from there..
Title: Scaling up
Post by: t-bear on August 20, 2004, 04:57:47 PM
$6.00 !!!!  WOW!!! That'd DOUBLE my present pay rate....oh goodie, goodie, goodie!  I can buy that Nash Rambler I been lookin' at in the junk yard.


Anybody know where I can get a Rambler motor?   Transmission?   Door? .......
Title: Scaling up
Post by: Dent Cermak on August 20, 2004, 05:27:28 PM
AND MAYBE THEN THAR SHOOOOES WIT THEM LIGHTING BOLTS ON THE SIDE!!