AutoCAD Electrical General Discussion

AutoCAD Electrical General Discussion

Reply
*Nate Holt
Message 1 of 7 (243 Views)

How do I display company internal USER1 catalog part numbers on components?

243 Views, 6 Replies
08-19-2004 05:53 PM
(note: this question came from a source outside of the discussion group but a response is shown here as it may be of general interest) I want to have my internal part numbers displayed as visible attributes on parent schematic components. I'm thinking of entering them in the USER1 field of the catalog lookup table records but I don't know how to map them to the component when I do a normal "catalog lookup" selection. Any suggestions? REPLY: If you're not concerned about having these internal part numbers show up in BOM reports but just want them to be visible as attribute text on the components, the quick way is to enter your internal part number in the TEXTVAL (or TEXTVALUE) field in the desired catalog lookup records. Most schematic parent symbols have three DESCn attributes. Use DESC3 as an existing attribute to display your internal part number coding. In the TEXTVAL/TEXTVALUE field, enter this: DESC3=. Now, when you do catalog lookup and select a part number (that has been modified as above), your internal part number will map to the component's DESC3 attribute. If you don't want to give up your DESC3 attribute but are willing to take the time to add a new attribute to selected parent component symbols, do it. Let's say you add attdef "INTERNAL_PN" to each parent schem library symbol. Now encode the TEXTVAL/TEXTVALUE field with INTERNAL_PN=. If you DO want this internal part number to also show up in your BOM reports, do either of the above PLUS put your part number into the USER1 field of the catalog record. Now, you'll see the part number visible on the component and also show up in the "USER1" column of the BOM and COMPONENT reports.
Contributor
mbrown
Posts: 14
Registered: ‎11-16-2005
Message 2 of 7 (243 Views)

Re: How do I display company internal USER1 catalog part numbers on components?

11-21-2005 11:56 AM in reply to: *Nate Holt
This works but I need it to find the info in USER1 field without having to retype it in the textvalue field. IE USER1=... I know there must be a way because a symbol will find the CAT, MFG and other info from the database.
*Nate Holt \(Autodesk\)
Message 3 of 7 (243 Views)

Re: How do I display company internal USER1 catalog part numbers on components?

11-21-2005 10:14 PM in reply to: *Nate Holt
Right now, there's not a good way within the application to do this. It is
not currently supported. But there is a work-around. If you APPLOAD the
attached utility and then type USER_CAT_2_SYMBOL [Enter] at the command
line, you can pick your devices and it will populate your added USER1,
USER2, and USER3 attributes on your modified symbols with the fields from
the catalog lookup. You can easily modify this routine to suit your needs.
It makes use of a couple calls from the AcadE "API".

Nate.



(defun c:user_cat_2_symbol ( / x xx cat_rec ben blknam mfg cat assycode)
; Utility to populate picked component with USER1/USER2/USER3
; values pulled from catalog lookup file
(while (setq x (entsel "\nPick component:"))
(setq ben (car x))
(if (AND (setq cat (c:wd_get_pnlval ben "CAT")) ; get "CAT" attribute or
xdata value
(/= cat ""))
(progn
(setq mfg (c:wd_get_pnlval ben "MFG"))
(setq assycode (c:wd_get_pnlval ben "ASSYCODE"))
(setq blknam (c:wd_get_pnlval ben "WDBLKNAM"))
(if (OR (not blknam)(= blknam ""))
(progn ; get actual block name
(setq blknam (cdr (assoc 2 (entget ben))))
) )
; Do catalog lookup on the target MFG/CAT/ASSYCODE combo
(setq x (wd_cat3_getcat nil mfg cat assycode blknam))
(if (AND x (/= (nth 16 x) "")) ; some data returned, use first or
only record
(progn
(setq cat_rec (car x))
; nth7=catalogdesc, 8=query1, 9=query2,....14=user3
(if (/= (nth 12 cat_rec) "") ; USER1 value
(progn ; non-blank USER1 value, write out to USER1 attribute
on block insert
(c:wd_modattrval ben "USER1" (nth 12 cat_rec) nil)
) )
(if (/= (nth 13 cat_rec) "") ; USER2 value
(progn ; non-blank USER1 value, write out to USER1 attribute
on block insert
(c:wd_modattrval ben "USER2" (nth 13 cat_rec) nil)
) )
(if (/= (nth 14 cat_rec) "") ; USER3 value
(progn ; non-blank USER1 value, write out to USER1 attribute
on block insert
(c:wd_modattrval ben "USER3" (nth 14 cat_rec) nil)
) )
) )
) )
)
(princ)
)






wrote in message news:5019339@discussion.autodesk.com...
This works but I need it to find the info in USER1 field without having to
retype it in the textvalue field. IE USER1=... I know there must be a way
because a symbol will find the CAT, MFG and other info from the database.
Contributor
mbrown
Posts: 14
Registered: ‎11-16-2005
Message 4 of 7 (243 Views)

Re: How do I display company internal USER1 catalog part numbers on components?

11-22-2005 05:35 AM in reply to: *Nate Holt
Thanks
Contributor
mbrown
Posts: 14
Registered: ‎11-16-2005
Message 5 of 7 (243 Views)

Re: How do I display company internal USER1 catalog part numbers on components?

11-22-2005 06:18 AM in reply to: *Nate Holt
The routine works fine except for one small problem. The USER1 information that the routine is finding is for the sub-assembly not for the main part. IE on a relay we use an icecube style relay and base which have there own part numbers. The base is the sub-assembly. The USER1 info being shown is the sub-assembly base. Is there a way to show both the USER1 info for the relay and the base? Is there a way to show the CATALOG name for both also?
*Nate Holt \(Autodesk\)
Message 6 of 7 (243 Views)

Re: How do I display company internal USER1 catalog part numbers on components?

11-22-2005 08:00 AM in reply to: *Nate Holt
You're exactly right, when the catalog lookup sees a "subassy" catalog item,
this is coming back as well and is at the top of the list of returned data.
I've modified the code to try to always use the main part number (reverse
the list of returned data and pick the first record). See if this works.
Don't be afraid to modify the utility to suit your needs. It's fun.

Nate.




; ** 22-Nov-05 NEHolt created for discussion group issue
(defun c:user_cat_2_symbol ( / x xx cat_rec ben blknam
mfg cat assycode)
; Utility to populate picked component with USER1/USER2/USER3
; values pulled from catalog lookup file
(while (setq x (entsel "\nPick component:"))
(setq ben (car x))
; get "CAT" attribute or xdata value
(if (AND (setq cat (c:wd_get_pnlval ben "CAT"))
(/= cat ""))
(progn
(setq mfg (c:wd_get_pnlval ben "MFG"))
(setq assycode (c:wd_get_pnlval ben "ASSYCODE"))
(setq blknam (c:wd_get_pnlval ben "WDBLKNAM"))
(if (OR (not blknam)(= blknam ""))
(progn ; get actual block name
(setq blknam (cdr (assoc 2 (entget ben))))
) )
; Do catalog lookup on the target MFG/CAT/ASSYCODE combo
(setq x (wd_cat3_getcat nil mfg cat assycode blknam))
(if x ; some data returned, use only or last record returned
; (will be the "main" part number),
; the sub-assy items will be at the top of the list
(progn
(setq x (reverse x)) ; reverse the list to make
; sure main part number is first
(setq cat_rec (car x)) ; get first (or only) record
; nth7=catalogdesc, 8=query1, 9=query2,....14=user3
(if (/= (nth 12 cat_rec) "") ; USER1 value
(progn ; non-blank USER1 value, write out to USER1
; attribute on block insert
(c:wd_modattrval ben "USER1" (nth 12 cat_rec) nil)
) )
(if (/= (nth 13 cat_rec) "") ; USER2 value
(progn ; non-blank USER2 value, write out to USER2
; attribute on block insert
(c:wd_modattrval ben "USER2" (nth 13 cat_rec) nil)
) )
(if (/= (nth 14 cat_rec) "") ; USER3 value
(progn ; non-blank USER3 value, write out to USER3
; attribute on block insert
(c:wd_modattrval ben "USER3" (nth 14 cat_rec) nil)
) )
) )
) )
)
(princ)
)






wrote in message news:5019954@discussion.autodesk.com...
The routine works fine except for one small problem. The USER1 information
that the routine is finding is for the sub-assembly not for the main part.
IE on a relay we use an icecube style relay and base which have there own
part numbers. The base is the sub-assembly. The USER1 info being shown is
the sub-assembly base. Is there a way to show both the USER1 info for the
relay and the base? Is there a way to show the CATALOG name for both also?
Contributor
mbrown
Posts: 14
Registered: ‎11-16-2005
Message 7 of 7 (243 Views)

Re: How do I display company internal USER1 catalog part numbers on components?

07-20-2009 01:08 PM in reply to: *Nate Holt
Nate,
The lisp routine has been working great but I have another problem. I need it to also obtain the user information on certain child symbols as well as parent symbols. Can you help?
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions to get help installing your software.

New AutoCAD Electrical Category!

The AutoCAD Electrical forum has moved into it's very own category page, and can no longer be found within the Additional Product Forums.

Announcements
Manufacturing Community
The Manufacturing Community provides additional access to tips, tutorials, blogs and networking with peers.