AutoCAD MEP General Discussion

AutoCAD MEP General Discussion

Reply
Active Contributor
dbillion
Posts: 45
Registered: ‎09-13-2005
Message 1 of 4 (234 Views)
Accepted Solution

How do you find an MvPart in a drawing by "handle"?

234 Views, 3 Replies
04-30-2012 01:26 PM

Greetings,

 

I'm working in AutoCAD MEP 2011.

 

When running a clash detection of a 6-story building in Navisworks (each floor is a separate construct file), I can select an MvPart in the view and get that element's handle (unique identifier).  How can I find that particular part in the construct file, by searching for its handle?

 

Is there a lsp routine out there that allows the user to enter a MvPart's handle, and have the program zoom to that part?

 

Many thanks,

Dave

Dave,

 

Try the below

 

code:

(defun C:HANDLE ( / handle ent )
(setq handle (getstring "\nEnter handle to search for: "))
(setq ent (handent handle))
(if ent
(progn ;line added
(sssetfirst nil (ssadd ent))
(command "_zoom" "_Object" ent)
)
;Else
(ALERT "The handle you entered does not exist in this drawing!")
)
(princ)
)
;;
;;
;;
(defun OwnerName (handle)
(cdr (assoc 2 (entget (cdr (assoc 330 (entget (handent handle)))))))
)

 

 

Valued Contributor
jcampbell
Posts: 55
Registered: ‎06-05-2007
Message 2 of 4 (224 Views)

Re: How do you find an MvPart in a drawing by "handle"?

05-01-2012 06:02 AM in reply to: dbillion

Dave,

 

Try the below

 

code:

(defun C:HANDLE ( / handle ent ) 
(setq handle (getstring "\nEnter handle to search for: ")) 
(setq ent (handent handle)) 
(if ent 
(progn ;line added 
(sssetfirst nil (ssadd ent)) 
(command "_zoom" "_Object" ent) 
) 
;Else 
(ALERT "The handle you entered does not exist in this drawing!") 
) 
(princ) 
) 
;;
;;
;;
(defun OwnerName (handle)
  (cdr (assoc 2 (entget (cdr (assoc 330 (entget (handent handle)))))))
)

 

 

Active Contributor
dbillion
Posts: 45
Registered: ‎09-13-2005
Message 3 of 4 (221 Views)

Re: How do you find an MvPart in a drawing by "handle"?

05-01-2012 06:30 AM in reply to: jcampbell

Works!  Just what I was looking for.  Thanks.

Valued Contributor
jcampbell
Posts: 55
Registered: ‎06-05-2007
Message 4 of 4 (219 Views)

Re: How do you find an MvPart in a drawing by "handle"?

05-01-2012 06:48 AM in reply to: dbillion

Welcome.  You may want to mark my post as the solution.

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 MEP Category!

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

Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!