Author Topic: Help, Problems with getfiled  (Read 12408 times)

0 Members and 1 Guest are viewing this topic.

KewlToyZ

  • Guest
Re: Help, Problems with getfiled
« Reply #15 on: May 03, 2006, 03:18:35 PM »
Congrats I think you did solve the directory issue :lmao:
My own typo caused it to error after correcting yours.

Code: [Select]
(defun c:dsu4 (/ usercmd ds rfgetbck rfgetbor rfgettit LayerMake)
(defun LayerMake(lyrname Color ltype)
(if (tblsearch "LAYER" lyrname)
(command "._Layer" "_Thaw" lyrname "_On" lyrname "_UnLock" lyrname "_Set" lyrname "")
(command "._Layer" "_Make" lyrname "_Color"
(if (or (null color)(= Color "")) "_White" Color) lyrname
"LT" (if (or (null ltype)(= ltype "")) "Continuous" ltype) lyrname "")
)
)
(setq usercmd (getvar "cmdecho"))
(setvar "cmdecho" 1); debug - turn cmd echo on
(setvar "xreftype" 1); set xref type for overlay
(command "rememberfolders" "1")
(command "saveas" "2004" "~")
(c:setscale)
(setup)
; (c:layerset-a)
(setq ds (getvar "dimscale"))
(setq rfgetbck (getfiled "Architects Background to XREF Overlay" (getvar "dwgprefix") "dwg" 2))
(setq rfgetbor (getfiled "Architects Titleblock Borders to XREF Overlay" (getvar "dwgprefix") "dwg" 2))
(setq rfgettit (getfiled "Titleblock Tags BLOCK to Insert" (getvar "dwgprefix") "dwg" 2))
(princ "\nWorking...")
;; =============================================================
;; Debug Code
(print)
(print rfgetbck)
(print rfgetbor)
(print rfgettit)
;; =============================================================

(if rfgetbck
(progn
(setq layname (vl-filename-base rfgetbck))
(LayerMake layname "8" nil)
(command "xref" "a" rfgetbck "0,0" "1" "" "")
(command "qsave")
;;(command "-xref" "p" layName layName)
(command "layer" "lock" layname "")
(print layname)
)
)
;end progn&if
(if rfgetbor
(progn
(setq layname (vl-filename-base rfgetbor))
(LayerMake layname "" nil)
(command "xref" "a" rfgetbor "0,0" ds "" "")
(command "qsave")
;;(command "-xref" "p" layname rfgetbor)
(command "layer" "lock" layname "")
(print layname)
)
)
;end progn&if
(if rfgettit
(progn
(setq layname (vl-filename-base rfgettit))
(LayerMake layname "" nil)
(command "attreq" "0")
(command "insert" rfgettit "0,0" ds "" "")
(command "attreq" "1")
(command "qsave")
(print layname)
)
)
;end progn&if

;; debug - remove the next line after testing
(setvar "CMDECHO" usercmd)
 
(command "units" "4" "64" "2" "4" "" "")
(command "mirrtext" 0)
(command "chamfer" "d" 0 0)
(command "fillet" "r" 0)
(setvar "fillmode" 1)
(command "visretain" 1)
(command "viewres" "y" 5000)
(command "ucsicon" "off")
(command "pellipse" 1)
(command "zoom" "extents")
(command "view" "save" "all")
(princ "\n ")
(c:shtsetup)
(end)
(setvar "CMDECHO" usercmd)
);end defun

Quote
Command: dsu4
rememberfolders
Enter new value for REMEMBERFOLDERS <1>: 1
Command: saveas
Current file format: AutoCAD 2004 Drawing
Enter file format [2000(LT2000)/2004/Standards/DXF/Template] <2004>: 2004 Save
drawing as <C:\X Store\Test Files\T9999\CADD\PLUM\dsu4.dwg>: ~
Command:
Working...

"C:\\X Store\\Test Files\\T9999\\CADD\\XREF\\ZbaseD.dwg"
"C:\\X Store\\Test Files\\T9999\\CADD\\XREF\\Zborders.dwg"
"C:\\X Store\\Test Files\\T9999\\CADD\\XREF\\Ztitles.dwg"

"ZbaseD"

"Zborders"
"Ztitles" units Report formats:      (Examples)

  1.  Scientific      1.55E+01
  2.  Decimal         15.50
  3.  Engineering     1'-3.50"
  4.  Architectural   1'-3 1/2"
  5.  Fractional      15 1/2

With the exception of Engineering and Architectural formats,
these formats can be used with any basic unit of measurement.
For example, Decimal mode is perfect for metric units as well
as decimal English units.

Enter choice, 1 to 5 <4>: 4
Enter denominator of smallest fraction to display
(1, 2, 4, 8, 16, 32, 64, 128, or 256) <64>: 64
Systems of angle measure:      (Examples)

  1.  Decimal degrees           45.0000
  2.  Degrees/minutes/seconds   45d0'0"
  3.  Grads                     50.0000g
  4.  Radians                   0.7854r
  5.  Surveyor's units          N 45d0'0" E

Enter choice, 1 to 5 <1>: 2 Enter number of fractional places for display of
angles (0 to 8) <4>: 4

Direction for angle 0d0'0":
   East    3 o'clock  =  0d0'0"
   North  12 o'clock  =  90d0'0"
   West    9 o'clock  =  180d0'0"
   South   6 o'clock  =  270d0'0"
Enter direction for angle 0d0'0" <0d0'0">:
Measure angles clockwise? [Yes/No] <N>
Command: mirrtext
Enter new value for MIRRTEXT <0>: 0
Command: chamfer
(TRIM mode) Current chamfer Dist1 = 0'-0", Dist2 = 0'-0"
Select first line or [uNdo/Polyline/Distance/Angle/Trim/Method/mUltiple]: d
Specify first chamfer distance <0'-0">: 0 Specify second chamfer distance
<0'-0">: 0
Command: fillet
Current settings: Mode = TRIM, Radius = 0'-0"
Select first object or [uNdo/Polyline/Radius/Trim/mUltiple]: r Specify fillet
radius <0'-0">: 0
Command: visretain
Enter new value for VISRETAIN <1>: 1
Command: viewres
Do you want fast zooms? [Yes/No] <Y>: y
Enter circle zoom percent (1-20000) <5000>: 5000
Command: ucsicon
Enter an option [ON/OFF/All/Noorigin/ORigin/Properties] <OFF>: off
Command: pellipse
Enter new value for PELLIPSE <1>: 1
Command: zoom
Specify corner of window, enter a scale factor (nX or nXP), or
[All/Center/Dynamic/Extents/Previous/Scale/Window/Object] <real time>: extents
Regenerating model.

Command: view Enter an option [?/Categorize/lAyer
state/Orthographic/Delete/Restore/Save/Ucs/Window]: save Enter view name to
save: all
UCSVIEW = 1  UCS will be saved with view
Command:

Initializing...expert
Enter new value for EXPERT <0>: 2
Command: layout
Enter layout option [Copy/Delete/New/Template/Rename/SAveas/Set/?] <set>: t
Enter file name: general/24x36.dwt Enter layout name(s) or [?]: 24x36
Command: layout
Enter layout option [Copy/Delete/New/Template/Rename/SAveas/Set/?] <set>: s
Enter layout to make current <Layout1>: 24x36 Regenerating layout.

Command: layer
Current layer:  "Ztitles"
Enter an option
[?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/Plot/Freeze/Thaw/LOck/Unlock/stAte]:
m
Enter name for new layer (becomes the current layer) <Ztitles>: defpoints Enter
an option
[?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/Plot/Freeze/Thaw/LOck/Unlock/stAte]:
t
Enter name list of layer(s) to thaw: defpoints Enter an option
[?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/Plot/Freeze/Thaw/LOck/Unlock/stAte]:
on
Enter name list of layer(s) to turn on: defpoints Enter an option
[?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/Plot/Freeze/Thaw/LOck/Unlock/stAte]:
Command: mview
Specify corner of viewport or
[ON/OFF/Fit/Shadeplot/Lock/Object/Polygonal/Restore/2/3/4] <Fit>: f
Regenerating model.

Command: mview
Specify corner of viewport or
[ON/OFF/Fit/Shadeplot/Lock/Object/Polygonal/Restore/2/3/4] <Fit>: h Hidden line
removal for plotting [ON/OFF]: off
Select objects:   1 found

Select objects:
Command: mspace
Command: zoom
Specify corner of window, enter a scale factor (nX or nXP), or
[All/Center/Dynamic/Extents/Previous/Scale/Window/Object] <real time>: w
Specify first corner: 0,0 Specify opposite corner: 3456,2304
Command: zoom
Specify corner of window, enter a scale factor (nX or nXP), or
[All/Center/Dynamic/Extents/Previous/Scale/Window/Object] <real time>: 1/96xp
Command: pspace
Command: zoom
Specify corner of window, enter a scale factor (nX or nXP), or
[All/Center/Dynamic/Extents/Previous/Scale/Window/Object] <real time>: e
Command: psetupin Enter file name: general/24x36.dwt Enter user defined page
setup(s) to import or [?]: Plotter01 Full Size
Command: psetupin Enter file name: general/24x36.dwt Enter user defined page
setup(s) to import or [?]: Plotter01 Half Size
Command: psetupin Enter file name: general/24x36.dwt Enter user defined page
setup(s) to import or [?]: Plotter02 Full Size
Command: psetupin Enter file name: general/24x36.dwt Enter user defined page
setup(s) to import or [?]: Plotter02 Half Size
Command: psetupin Enter file name: general/24x36.dwt Enter user defined page
setup(s) to import or [?]: Plotter03 Full Size
Command: psetupin Enter file name: general/24x36.dwt Enter user defined page
setup(s) to import or [?]: Plotter03 Half Size
Command: psetupin Enter file name: general/24x36.dwt Enter user defined page
setup(s) to import or [?]: Acrobat Distiller Full Size
Command: psetupin Enter file name: general/24x36.dwt Enter user defined page
setup(s) to import or [?]: Acrobat Distiller Half Size
Command: psetupin Enter file name: general/24x36.dwt Enter user defined page
setup(s) to import or [?]: eDoc PDF Full Size
Command: psetupin Enter file name: general/24x36.dwt Enter user defined page
setup(s) to import or [?]: eDoc PDF Half Size
Command: psetupin Enter file name: general/24x36.dwt Enter user defined page
setup(s) to import or [?]: Plot to File Full Size
Command: psetupin Enter file name: general/24x36.dwt Enter user defined page
setup(s) to import or [?]: Plot to File Half Size
Command: psetupin Enter file name: general/24x36.dwt Enter user defined page
setup(s) to import or [?]: Old Bond Plotter Full Size
Command: psetupin Enter file name: general/24x36.dwt Enter user defined page
setup(s) to import or [?]: Old Bond Plotter Half Size
Command: psetupin Enter file name: general/24x36.dwt Enter user defined page
setup(s) to import or [?]: Old Vellum Plotter Full Size
Command: psetupin Enter file name: general/24x36.dwt Enter user defined page
setup(s) to import or [?]: Old Vellum Plotter Half Size
Command: expert
Enter new value for EXPERT <2>: 0
Command: model Regenerating model.

Command: layout
Enter layout option [Copy/Delete/New/Template/Rename/SAveas/Set/?] <set>: d
Enter name of layout to delete <24x36>: Layout1 Layout "Layout1" deleted.

Command: layout
Enter layout option [Copy/Delete/New/Template/Rename/SAveas/Set/?] <set>: d
Enter name of layout to delete <24x36>: Layout2 Layout "Layout2" deleted.

Command:
Architectural or Engineering pens (A/<E>):
undo Current settings: Auto = On, Control = All, Combine = Yes
Enter the number of operations to undo or [Auto/Control/BEgin/End/Mark/Back]
<1>: e
Command: undo Current settings: Auto = On, Control = All, Combine = Yes
Enter the number of operations to undo or [Auto/Control/BEgin/End/Mark/Back]
<1>: e
Command:


I'm surprised it came down to the layername being an issue causing the failure.
Now if I can parse the xref paths to relative ..\XREF make them overlay and get the title insert to run its block attributes dialog I have a winner.
Whee more research lol.
Actually you have helped me a great deal. I was chasing the wrong issue it would seem.
« Last Edit: May 03, 2006, 03:49:41 PM by CAB »

KewlToyZ

  • Guest
Re: Help, Problems with getfiled
« Reply #16 on: May 03, 2006, 03:29:25 PM »
overlay switch was easy enough.
I have to look over how to parse a variable path with one common element.

Jeff_M

  • King Gator
  • Posts: 4040
  • C3D user & customizer
Re: Help, Problems with getfiled
« Reply #17 on: May 03, 2006, 03:37:11 PM »
<snip> I was chasing the wrong issue it would seem.
I would venture a guess here and say that 90% of all beginner's attempts at debugging code start and head in the wrong direction......I know, I was once there.

For the relative paths.....could you show us the exact structure of the paths for the drawing & xrefs?

CAB

  • Global Moderator
  • Seagull
  • Posts: 10399
Re: Help, Problems with getfiled
« Reply #18 on: May 03, 2006, 03:52:22 PM »
Great when it works isn't it. :-)
I've reached the age where the happy hour is a nap. ()
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

KewlToyZ

  • Guest
Re: Help, Problems with getfiled
« Reply #19 on: May 03, 2006, 04:32:27 PM »
<snip> I was chasing the wrong issue it would seem.
I would venture a guess here and say that 90% of all beginner's attempts at debugging code start and head in the wrong direction......I know, I was once there.

For the relative paths.....could you show us the exact structure of the paths for the drawing & xrefs?

Well using a Network drive to generalize it so to speak:
X:\Alphabetical\Project#\CADD\XREF\        contains the xrefs of the project
X:\Alphabetical\Project#\CADD\ARCH\       contains architects files to create xref files
X:\Alphabetical\Project#\CADD\ELEC\        discipline specific drawings
X:\Alphabetical\Project#\CADD\MECH\        discipline specific drawings
X:\Alphabetical\Project#\CADD\PLUM\        discipline specific drawings
X:\Alphabetical\Project#\CADD\TELE\        discipline specific drawings
X:\Alphabetical\Project#\CADD\DEMO\        discipline specific drawings

Mainly if the cadd folder is zipped up all of the xref's will be relative for outside clients.
Trying to help things along with a National CAD Standard so to speak making things lower maintenance in the initial set up.
Also breaking this up for multiple states partner firms to access and browse through the intranet by keeping less files per folder for each browse to refresh on the screen.

KewlToyZ

  • Guest
Re: Help, Problems with getfiled
« Reply #20 on: May 03, 2006, 04:34:26 PM »
Great when it works isn't it. :-)

CAB I have to thank you again.
Can you tell me what it is that gave you the insight?

Jeff_M

  • King Gator
  • Posts: 4040
  • C3D user & customizer
Re: Help, Problems with getfiled
« Reply #21 on: May 03, 2006, 04:43:26 PM »
OK, I think that this is what you are looking for......
Code: [Select]
(setq rel-path (strcat "..\\XREF\\" (vl-filename-base rfgetbck) ".dwg"))

Jeff_M

  • King Gator
  • Posts: 4040
  • C3D user & customizer
Re: Help, Problems with getfiled
« Reply #22 on: May 03, 2006, 05:08:03 PM »
And maybe something like this to force the user to select the Xref files from the XREF folder?
Code: [Select]
(setq prefx (getvar "dwgprefix"))
(setq idx (vl-string-search "CADD" prefx))
(setq baseprefix (strcat (substr prefx 1 (+ 5 idx)) "XREF\\"))

  (setq rfgetbck (getfiled "Background to XREF Overlay" baseprefix "dwg" 2))
  (setq rfgetbor (getfiled "Titleblock Borders to XREF Overlay" baseprefix "dwg" 2))
  (setq rfgettit (getfiled "Titleblock Title Info BLOCK to insert" baseprefix "dwg" 2))

KewlToyZ

  • Guest
Re: Help, Problems with getfiled
« Reply #23 on: May 03, 2006, 05:22:16 PM »
OK, I think that this is what you are looking for......
Code: [Select]
(setq rel-path (strcat "..\\XREF\\" (vl-filename-base rfgetbck) ".dwg"))


You rock! I was reading through strcat to get my format. I was close and about to come back and post but you already had it :-)


KewlToyZ

  • Guest
Re: Help, Problems with getfiled
« Reply #24 on: May 03, 2006, 05:27:25 PM »
And maybe something like this to force the user to select the Xref files from the XREF folder?
Code: [Select]
(setq prefx (getvar "dwgprefix"))
(setq idx (vl-string-search "CADD" prefx))
(setq baseprefix (strcat (substr prefx 1 (+ 5 idx)) "XREF\\"))

(setq rfgetbck (getfiled "Background to XREF Overlay" baseprefix "dwg" 2))
(setq rfgetbor (getfiled "Titleblock Borders to XREF Overlay" baseprefix "dwg" 2))
(setq rfgettit (getfiled "Titleblock Title Info BLOCK to insert" baseprefix "dwg" 2))

Alot to be thankful for here.
Jeff that was a finishing touch it needed.

Make me work a little bit though ok ?  :lmao:

Is it possible to have the attribute fire up a dialog during insert or can I reinitialize those attributes after insertion?

Jeff_M

  • King Gator
  • Posts: 4040
  • C3D user & customizer
Re: Help, Problems with getfiled
« Reply #25 on: May 03, 2006, 05:46:40 PM »
Is it possible to have the attribute fire up a dialog during insert or can I reinitialize those attributes after insertion?
Yes.....
During insert....replace the (command "attreq" 0) with:
(sevar "attreq" 1")
(setvar "attdia" 1)

I'll let you search this site for doing it after the fact...... ;-)

One other note, to keep things from getting to the command line that may just confuse a user, don't use (command) to set Sysvars.....use (setvar) as I did above. This method does not echo to the command line.

KewlToyZ

  • Guest
Re: Help, Problems with getfiled
« Reply #26 on: May 03, 2006, 06:10:38 PM »
Thanks Jeff!
You & CAB have shown me enough in one day to really help my understanding.
I was really feeling beaten up trying to piece it together.
Mostly I figured it was a format and syntax issue with myself when I tried to find information to help me along.
I'll post the finished item when I'm done.

KewlToyZ

  • Guest
Re: Help, Problems with getfiled
« Reply #27 on: May 03, 2006, 07:55:14 PM »
Code: [Select]
;;; Drawing Set Up Routine
;;; Special thanks to CAB & Jeff at www.theswamp.org
;;; http://www.theswamp.org/index.php?action=post;topic=9928.15;num_replies=26

(defun c:dwgsetup(/ usercmd ds rfgetbck rfgetbor rfgettit LayerMake)
  (defun LayerMake(lyrname Color ltype)
  (if (tblsearch "LAYER" lyrname)
    (command "._Layer" "_Thaw" lyrname "_On" lyrname "_UnLock" lyrname "_Set" lyrname "")
    (command "._Layer" "_Make" lyrname "_Color"
             (if (or (null color)(= Color "")) "_White" Color) lyrname
             "LT" (if (or (null ltype)(= ltype "")) "Continuous" ltype) lyrname "")
  )
)
  (setq usercmd (getvar "cmdecho"))
  (setvar "cmdecho" 1); debug - turn cmd echo on
;  (setvar "xreftype" 1); set xref type for overlay ----disabled for 2004 enabled for 2006
  (command "rememberfolders" "1")
  (command "dimscale" "96")
  (command "saveas" "2004" "~")
  (c:setscale)
  (setup)
  (setq ds (getvar "dimscale"))
  (setq prefx (getvar "dwgprefix"))
  (setq idx (vl-string-search "CADD" prefx))
  (setq baseprefix (strcat (substr prefx 1 (+ 5 idx)) "XREF\\"))
  (setq rfgetbck (getfiled "Background to XREF Overlay" baseprefix "dwg" 2))
  (setq rfgetbor (getfiled "Titleblock Borders to XREF Overlay" baseprefix "dwg" 2))
  (setq rfgettit (getfiled "Titleblock Title Info BLOCK to insert" baseprefix "dwg" 2))
  (princ "\nWorking...")
;; =============================================================
;;  Debug Code
  (print)
  (print rfgetbck)
  (print rfgetbor)
  (print rfgettit)
;; =============================================================

  (if rfgetbck
    (progn
      (setq layname (vl-filename-base rfgetbck))
      (setq rel-path (strcat "..\\XREF\\" (vl-filename-base rfgetbck) ".dwg"))
      (LayerMake layname "8" nil)
      (command "xref" "o" rfgetbck "0,0" "1" "" "")
      (command "qsave")
      ;(command "-xref" "p" layName (strcat rel-path refgetbck))
      (command "-xref" "p" layName rel-path)
      (command "layer" "lock" layname "")
      (print layname)
    )
  )
;end progn&if
  (if rfgetbor
    (progn
      (setq layname (vl-filename-base rfgetbor))
      (setq rel-path (strcat "..\\XREF\\" (vl-filename-base rfgetbor) ".dwg"))
      (LayerMake layname "" nil)
      (command "xref" "o" rfgetbor "0,0" ds "" "")
      (command "qsave")
      ;(command "-xref" "p" layname (strcat rel-path refgetbor))
      (command "-xref" "p" layname rel-path)
      (command "layer" "lock" layname "")
      (print layname)
    )
  )
;end progn&if
  (if rfgettit
    (progn
      (setq layname (vl-filename-base rfgettit))
      (LayerMake layname "" nil)
      (setvar "attreq" 1)
      (setvar "attdia" 1)   
      (command "insert" rfgettit "0,0" ds "" "")
      (command "qsave")
      (print layname)
    )
  )
;end progn&if

;;  debug - remove the next line after testing
  (setvar "CMDECHO" usercmd)
 
  (command "units" "4" "64" "2" "4" "" "")
  (command "mirrtext" 0)
  (command "chamfer" "d" 0 0)
  (command "fillet" "r" 0)
  (setvar "fillmode" 1)
  (setvar "visretain" 1)
  (command "viewres" "y" 5000)
  (command "ucsicon" "off")
  (setvar "pellipse" 1)
  (command "zoom" "extents")
  (command "view" "save" "all")
  (princ "\n ")
  (c:shtsetup) 
  (end)
  (setvar "CMDECHO" usercmd)
)
;end defun