VDocPortal
english version
 
Site map
Actualités
Actualités MyDesk
More news
More news
News Autodesk MSD
Autodesk Manufacturing RSS Feed

This posting is triggered by a recent user request. The Create Wiretype command allows a number of wire parameters to be associated to a given wire layer. But how can these be accessed with a user-created utility?


The need is to look at each source/destination arrow symbol, find the attached wire, and determine the wire type (i.e. the wire "layer" name). Then access the defined data for the given wire type. Pull two of this wire type's parameters from its definition and push them on to two new attributes the user has added to his source/destination arrow symbols.


This solution is in two parts: 1) modify the library symbols to include the new target attributes, and 2) create a little AutoLISP utility to find the wiretype data related to the wire tied to each source/destination arrow symbols and push two elements of this data back into the symbol as visible values on the two new target attributes.


Add two new attributes to the Source/Destination arrow symbols


This is the first step. User adds attributes COLOR and SIZE to each of the arrow symbols. In this example the attribute definitions are located just below the XREF attribute that carries the "From xxx" or "To xxx" cross-reference annotation.



All done. That's the simple, boring part. Now the fun part begins... creating the software application to make it all work.


How this think will work


Let's design it so that the utility prompts the user to pick on each signal source or destination arrow symbol. The utility reads the symbol and confirms that it is a source or destination symbol. Then it finds the wire tied to the symbol and extracts the wire's layer name (i.e. the wire's "wire type").



Next it makes an API call to query the scratch database to find all wiretypes tied to the active drawing. On the record that matches the passed layer name, it returns the list of color, size, and USERn values assigned to this wire type.


It pulls out the color and size values and pushes them out to the two new attributes found on the source/destination arrow symbols.



That's it!


Here is the application:


; ** 09-Oct-2008 NEHolt created

; --------   W I R E T Y P E _ A N N O . L S P  -------

(defun c:wiretype_anno ( / rtrn dwgix laynam ben blknam

                  color size x ed wtlst lst wen xitflg)

  ; PURPOSE: push WIRETYPE's "color" and "size" settings

  ;    out to target attributes on picked Source or

  ;    Destination arrow symbol.

 

  ; -- internal functions --


  (defun get_wiretype_data ( laynam / rtrn dwgix)

    ; Find and return all data tied to target "laynam"

    ; on active drawing in active project.

    ; "laynam" = wiretype layer name

    (setq rtrn nil)

    (setq dwgix nil)

    ; Set global GBL_wd_cip which carries the position

    ; that active drawing is in relative to all drawings

    ; listed in the project's ".wdp" file.

    (if (OR (= GBL_wd_cip 0)(not GBL_wd_cip))

      (wd_wdp_is_active_in_proj)) ; set the global

    ; Now figure out the drawing's DWGIX value that

    ; is used in the project's scratch database to

    ; identify this active drawing. 

    (if (/= GBL_wd_cip 0)

      (setq dwgix (wd_mdb_wdp2ix_ix GBL_wd_cip)))

    ; Now call an API function that queries the

    ; active project's scratch database file tables

    ; WIRETYPE and WIRETYPE_USR to find all

    ; info about wiretype "laynam" as defined on

    ; the active drawing (i.e. the active drawing's

    ; "DWGIX" value. 

    (if (AND laynam (/= laynam "") dwgix)

      (setq rtrn (ace_query_wiretype dwgix laynam))

    ) 

    rtrn ; nil=not found, otherwise a list of wire

         ; type COLOR, SIZE, and USER1-USER20

  )

 

  ; -- main program starts here --

  (setq xitflg nil)

  (while (not xitflg)

    (setq xitflg T) ; default to exit loop

    ; Prompt user to pick on Source/Destination

    ; arrow that needs to be annotated.

    (setq x (entsel "\nSelect source/destination arrow:"))

    (if x

      (progn

        (setq ben (car x)) ; entity name of pick

        (setq ed (entget ben)) ; open it

        (if (= (cdr (assoc 0 ed)) "INSERT")

          (progn ; so far, so good

            (setq blknam (cdr (assoc 2 ed)))

            ; Make sure it is an arrow symbol

            (if (wcmatch blknam "?A#S*,?A#D*")

              (progn ; yes, keep going

                ; Look for attached wire

                (setq lst (c:wd_get_sym_pntlst ben 1 nil))

                (if lst

                  (progn ; go for first or only connection

                    (setq wen (car (nth 3 (car lst))))

                    ; Get layer name of connected wire

                    (setq laynam (cdr (assoc 8 (entget wen))))

                    ; Now get COLOR and SIZE info for this

                    ; wire type

                    (setq wtlst (get_wiretype_data laynam))

                    (if wtlst

                      (progn ; have some data

                        (setq color (car wtlst))

                        (setq size (cadr wtlst))

                        ; Push these on to the Source/Dest

                        ; arrow symbol.

                       

                        ; ** SET TARGET ATTRIBUTE HERE **

                        (c:wd_modattrval ben "COLOR" color nil)

                        (c:wd_modattrval ben "SIZE" size nil)

                       

                        (setq xitflg nil) ; stay in loop

  ) ) ) ) ) ) ) ) ) ) )

  (princ) ; quiet return

)


You can download this file here: files/22201_22300/22257/file_22257.lsp


... then


1. rename the downloaded file to "WIRETYPE_ANNO.LSP"


2. to run, open target drawing and APPLOAD your renamed file "WIRETYPE_ANNO.LSP".


3. Type WIRETYPE_ANNO [Enter] and the command line and start selecting the source/destination symbols to adjust.


 


 


 

Autodesk Manufacturing


Digital Prototypes in Inventor: Shaft Generator


If you ever need to create shafts and haven't taken a look at the Shaft Generator, you shouldn't miss this great write-up on the Shaft Generator.



It starts out explaining how to create a simple shaft then covers adding things like Chamfers, Retaining-Ring Grooves, Keyways and more. This is a very powerful tool and should help you get started if you ever need to create shafts. Once you understand how to do a few things like these, you will be able to add holes in the side, run calculation to check strength and many other things with the Shaft Generator.


Enjoy!


Autodesk Manufacturing


Digital Prototypes in Inventor: Shaft Generator


If you ever need to create shafts and haven't taken a look at the Shaft Generator, you shouldn't miss this great write-up on the Shaft Generator.



It starts out explaining how to create a simple shaft then covers adding things like Chamfers, Retaining-Ring Grooves, Keyways and more. This is a very powerful tool and should help you get started if you ever need to create shafts. Once you understand how to do a few things like these, you will be able to add holes in the side, run calculation to check strength and many other things with the Shaft Generator.


Enjoy!


Autodesk Manufacturing

As part of the ongoing care for Vault database, Administrators should be versed on the use of backup scripts, maintenance plans (database defragmentation) in addition to regular health checks which may include reviewing backup and vault logs and database size.


This last check can be an issue for some sites under strict controls for their data footprint or looking to extend the use of their current hardware in a prolific design environment. To address this, manual purging can be carried out at the end of the design cycle to periodically manage file versions. From Vault Explorer, you can right click any file and select Purge from the context menu.



In addition, from the ADMS Console, a purge can be run across all versions on a per-Vault basis. Right click on a database under Vaults and select Purge. Like the client side wizard, there are options for number of versions to keep, age of versions, and exclusions based on comments.



Finally, this can be scheduled to run as a batch operation month to month or as an Administrator sees fit. Much like the backup command line utility, the purge command is executed with a series of switches as indicated in the example below:


Connectivity.ADMSConsole.exe -Opurge –N –KEEPVERS -MINAGE -EXCLCMT -VUadministrator –VP -S


Note that it is optional as to whether you put in one or all of the three purge options KEEPVERS, MINAGE and EXCLCMT. This script can then be added to a batch file *.bat and run from the Windows Task Scheduler similarly to your backup script (with lower frequency). Please refer to the ADMS Console Help, ‘Server Console’ chapter, ‘Command Line Server Console’ for more details.


It is worth noting that aggressive file purging is no substitute for the correct data storage plan and in fact may limit the version functionality in the design environment, but used sensibly this process can compliment your other maintenance tasks.


-Brian Schanen


Autodesk Manufacturing
As Erik Duval, my fellow "snowflake" knows all too well from my incessant ramblings over the years, I’m of the sincere belief that the purpose of life is happiness. By this I mean happiness or joy of the very deep,...
Autodesk Manufacturing