AutoCAD Electrical Forum
Welcome to Autodesk’s AutoCAD Electrical Forums. Share your knowledge, ask questions, and explore popular AutoCAD Electrical topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

API doc correction - "next dwg's SHEET" example under "wd_is_cur_dwg_in_proj" topic

5 REPLIES 5
Reply
Message 1 of 6
Anonymous
528 Views, 5 Replies

API doc correction - "next dwg's SHEET" example under "wd_is_cur_dwg_in_proj" topic

There is an error in the user Application Programming Interface (API)
documentation topic in the AutoCAD Electrical 2006 on line help. The problem
is an error in the example program shown under the "wd_is_cur_dwg_in_proj"
topic. A new, expanded version of the sample code is given here:

The two programs below return the WD_M block's SHEET attribute value
assignment of the next and the previous drawing relative to the current
active drawing. You can set up your title block update utility (via the
".wdt" mapping file) to call each of these small utilities and automatically
update each title block with the SHEET number of the next and previous
drawings.

; ----
(defun c:nextsheet ( / ix sheet_lst x sheet)
; Return the WD_M block's SHEET attribute value of "next" dwg in project.
Useful
; for calling from the title block update utility illustrated under the
"Invoking API calls
; from Title BLock .wdt mapping file" topic.
(if (not gbl_wd_prj_ixlst) (setq gbl_wd_prj_ixlst (c:ace_proj_data nil)))
(setq ix (c:wd_is_cur_dwg_in_proj))
(setq sheet "")
(if (> ix 0)
(progn ; current drawing is in the project, increment to next dwg in
list
(setq ix (1+ ix))
(setq sheet_lst (nth 3 GBL_wd_prj_ixlst))
; Get next drawing's SHEET value
(if (setq x (member ix (nth 1 GBL_wd_prj_ixlst)))
(progn ; found relative position of next dwg's data in parallel
lists
(setq sheet (nth (- (length (nth 1 GBL_wd_prj_ixlst)) (length x))
(nth 3 GBL_wd_prj_ixlst)))
)
)
) )
sheet ; return "" or next SHEET value
)
; ----
(defun c:prevsheet ( / ix sheet_lst x sheet)
; Return the WD_M block's SHEET attribute value of "previous" dwg in
project
(if (not gbl_wd_prj_ixlst) (setq gbl_wd_prj_ixlst (c:ace_proj_data nil)))
(setq ix (c:wd_is_cur_dwg_in_proj))
(setq sheet "")
(if (> ix 1)
(progn ; current drawing is in the project and not first dwg,
; decrement to prev dwg in list
(setq ix (1- ix))
(setq sheet_lst (nth 3 GBL_wd_prj_ixlst))
; Get next drawing's SHEET value
(if (setq x (member ix (nth 1 GBL_wd_prj_ixlst)))
(progn ; found relative position of next dwg's data in parallel
lists
(setq sheet (nth (- (length (nth 1 GBL_wd_prj_ixlst)) (length x))
(nth 3 GBL_wd_prj_ixlst)))
)
)
) )
sheet ; return "" or previous SHEET value
)
5 REPLIES 5
Message 2 of 6
healdp
in reply to: Anonymous

Thanks Nate.
I'll ensure the API documentation is updated appropriately.
Peter Heald (Autodesk)
Message 3 of 6
Peter_KSBE
in reply to: Anonymous

Nate,

Is there a possibility to include sheets who are marked "This drawing is for reference only (will not be processed)" to also show the "next..." and "prev...." values?

What is my problem:
The first page is the title page, the next pages are the index. There is no need to process them every time, so I have marked in their properties the above mentioned item.
Now when I update the title block the lisp ignores these drawings and returns " " as value for "next...." and "prev...."
Message 4 of 6
Anonymous
in reply to: Anonymous

Looks like there is not a work-around to this. When a drawing is marked "ref
only", then it is totally excluded from being processed and having its data
(including SHEET attribute value) pulled into the project's scratch database
file. The little AutoLisp utility you're trying to use accesses a global
variable "GBL_wd_prj_ixlst" that is constructed from key data pulled from
the scratch database. So, if the ref-only dwgs are not in the database, then
this global will not have any relevant data for the AutoLisp utility to grab
(for a ref-only dwg).

I believe the solution is to either manually annotate these title blocks or
"unmark" these drawings as reference-only and let them get included in the
project's processing. Sorry!

Nate.

wrote in message news:5104614@discussion.autodesk.com...
Nate,

Is there a possibility to include sheets who are marked "This drawing is for
reference only (will not be processed)" to also show the "next..." and
"prev...." values?

What is my problem:
The first page is the title page, the next pages are the index. There is no
need to process them every time, so I have marked in their properties the
above mentioned item.
Now when I update the title block the lisp ignores these drawings and
returns " " as value for "next...." and "prev...."
Message 5 of 6
Anonymous
in reply to: Anonymous

Update for AcadE 2008 - the previous version of this utility doesn't work
correctly in the ACE2008 version of project-wide title block update. This is
because the update now happens without cycling through the drawings
(displaying them one-at-a-time in the AutoCAD editor). Minor change to the
lisp utility should restore its function. Use attached.
Nate.


"Nate Holt (Autodesk)" wrote in message
news:4840813@discussion.autodesk.com...
There is an error in the user Application Programming Interface (API)
documentation topic in the AutoCAD Electrical 2006 on line help. The problem
is an error in the example program shown under the "wd_is_cur_dwg_in_proj"
topic. A new, expanded version of the sample code is given here:

The two programs below return the WD_M block's SHEET attribute value
assignment of the next and the previous drawing relative to the current
active drawing. You can set up your title block update utility (via the
".wdt" mapping file) to call each of these small utilities and automatically
update each title block with the SHEET number of the next and previous
drawings.

; ----
(defun c:nextsheet ( / ix sheet_lst x sheet)
; Return the WD_M block's SHEET attribute value of "next" dwg in project.
Useful
; for calling from the title block update utility illustrated under the
"Invoking API calls
; from Title BLock .wdt mapping file" topic.
(if (not gbl_wd_prj_ixlst) (setq gbl_wd_prj_ixlst (c:ace_proj_data nil)))
(setq ix (c:wd_is_cur_dwg_in_proj))
(setq sheet "")
(if (> ix 0)
(progn ; current drawing is in the project, increment to next dwg in
list
(setq ix (1+ ix))
(setq sheet_lst (nth 3 GBL_wd_prj_ixlst))
; Get next drawing's SHEET value
(if (setq x (member ix (nth 1 GBL_wd_prj_ixlst)))
(progn ; found relative position of next dwg's data in parallel
lists
(setq sheet (nth (- (length (nth 1 GBL_wd_prj_ixlst)) (length x))
(nth 3 GBL_wd_prj_ixlst)))
)
)
) )
sheet ; return "" or next SHEET value
)
; ----
(defun c:prevsheet ( / ix sheet_lst x sheet)
; Return the WD_M block's SHEET attribute value of "previous" dwg in
project
(if (not gbl_wd_prj_ixlst) (setq gbl_wd_prj_ixlst (c:ace_proj_data nil)))
(setq ix (c:wd_is_cur_dwg_in_proj))
(setq sheet "")
(if (> ix 1)
(progn ; current drawing is in the project and not first dwg,
; decrement to prev dwg in list
(setq ix (1- ix))
(setq sheet_lst (nth 3 GBL_wd_prj_ixlst))
; Get next drawing's SHEET value
(if (setq x (member ix (nth 1 GBL_wd_prj_ixlst)))
(progn ; found relative position of next dwg's data in parallel
lists
(setq sheet (nth (- (length (nth 1 GBL_wd_prj_ixlst)) (length x))
(nth 3 GBL_wd_prj_ixlst)))
)
)
) )
sheet ; return "" or previous SHEET value
)
Message 6 of 6
Anonymous
in reply to: Anonymous


Having trouble with attachment. Here is the code
with changes for ACE2008 marked in red. Cut and paste into a text file
with ".lsp" extension.

 

(defun c:nextsheet ( / ix sheet_lst x
sheet)
   ; Return the WD_M block's SHEET attribute value of "next"
dwg in project
   (if (not gbl_wd_prj_ixlst) (setq gbl_wd_prj_ixlst
(c:ace_proj_data nil)))
   (setq ix GBL_wd_cip)
; index for where current dwg is listed in project list
   (if (OR
(not ix)(= ix 0))(setq ix (c:wd_is_cur_dwg_in_proj)))
  
(setq sheet "")
   (if (> ix 0)
    
(progn ; current drawing is in the project, increment to next dwg in
list
       (setq ix (1+
ix))
       (setq sheet_lst (nth 3
GBL_wd_prj_ixlst))
       ; Get next drawing's
SHEET value
       (if (setq x (member ix (nth
1 GBL_wd_prj_ixlst)))
         (progn
; found relative position of next dwg's data in parallel
lists
           (setq
sheet (nth (- (length (nth 1 GBL_wd_prj_ixlst)) (length
x))
                     
(nth 3 GBL_wd_prj_ixlst)))
        
)
       )
   )
)   
   sheet  ; return "" or next SHEET
value
)
; ----
(defun c:prevsheet ( / ix sheet_lst x
sheet)
   ; Return the WD_M block's SHEET attribute value of
"previous" dwg in project
   (if (not gbl_wd_prj_ixlst) (setq
gbl_wd_prj_ixlst (c:ace_proj_data nil)))
  
(setq ix GBL_wd_cip) ; index for where current dwg is listed in project
list
   (if (OR (not ix)(= ix 0))(setq ix
(c:wd_is_cur_dwg_in_proj)))
   (setq sheet
"")
   (if (> ix 1)
     (progn ; current
drawing is in the project and not first dwg,

            ;
decrement to prev dwg in list
       (setq ix
(1- ix))
       (setq sheet_lst (nth 3
GBL_wd_prj_ixlst))
       ; Get next drawing's
SHEET value
       (if (setq x (member ix (nth
1 GBL_wd_prj_ixlst)))
         (progn
; found relative position of next dwg's data in parallel
lists
           (setq
sheet (nth (- (length (nth 1 GBL_wd_prj_ixlst)) (length
x))
                     
(nth 3 GBL_wd_prj_ixlst)))
        
)
       )
   )
)   
   sheet  ; return "" or previous SHEET
value
 )

 

 

Update for AcadE 2008 - the
previous version of this utility doesn't work
correctly in the ACE2008
version of project-wide title block update. This is
because the update now
happens without cycling through the drawings
(displaying them one-at-a-time
in the AutoCAD editor). Minor change to the
lisp utility should restore its
function. Use attached.
Nate.


"Nate Holt (Autodesk)" <

href="mailto:nate.holt@autodesk.com">
size=2>nate.holt@autodesk.com
> wrote in
message

face=Arial size=2>news:4840813@discussion.autodesk.com

face=Arial size=2>...
There is an e
rror in the user Application
Programming Interface (API)
documentation topic in the AutoCAD Electrical
2006 on line help. The problem
is an error in the example program shown under
the "wd_is_cur_dwg_in_proj"
topic. A new, expanded version of the sample code
is given here:

The two programs below return the WD_M block's SHEET
attribute value
assignment of the next and the previous drawing relative to
the current
active drawing. You can set up your title block update utility
(via the
".wdt" mapp
ing file) to call each of these small utilities and
automatically
update each title block with the SHEET number of the next and
previous
drawings.

; ----
(defun c:nextsheet ( / ix sheet_lst x
sheet)
   ; Return the WD_M block's SHEET attribute value of "next"
dwg in projec

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost