Author Topic: Select modelspace entities in paperspace  (Read 7313 times)

0 Members and 1 Guest are viewing this topic.

MickD

  • King Gator
  • Posts: 3636
  • (x-in)->[process]->(y-out) ... simples!
Select modelspace entities in paperspace
« on: November 30, 2005, 09:44:17 PM »
Hi all,
Does anybody have any code examples of selecting modelspace entities in a viewport from paperspace? (without 'activating' the viewport)

or

Any ideas on the best way to achieve something like this?

TIA,
Mick.
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Select modelspace entities in paperspace
« Reply #1 on: December 01, 2005, 05:19:54 AM »
[semi-automated unhelpful response]

That sounds like a tricky one Mick.
As you know, I'm not a regularly practicing VBer, but I can't think of any way to achieve this using the ActiveX Object Model.

.. nor with AutoLisp nor the Net API tools.

AutoDesk has found a way in its core 'cause associative dimensioning and object dimensioning allow for object selection in PaperSpace.

If you cant get a definitive answer, I could kick the question upstairs, for whatever that's worth.

good luck

kwb

kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Select modelspace entities in paperspace
« Reply #2 on: December 01, 2005, 05:31:19 AM »
Quote
There is an undocumented ObjectARX function called acedNEntSelPEx() which may be usable. Itis not officially supported and may be removed or changed at any time.

You may be able to wrap this from a home built COM server ...

.. there may be too many 'mays' in this post :-)

kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

MickD

  • King Gator
  • Posts: 3636
  • (x-in)->[process]->(y-out) ... simples!
Re: Select modelspace entities in paperspace
« Reply #3 on: December 01, 2005, 06:17:48 AM »
Thanks Kerry, I have had a brief  look for it before (in the arx lib headers and such) with little luck, I 'may' have to try again :).
I remember something about a picked point being transformed from pspace to mspace and picking an entity 'at that point' using vba or lisp. Having never used (read coded for) paperspace and view ports I'm at a loss and after a bit of a head start if someone has one.
My plans are for .net but I posted here hoping that maybe someone using vba has done something similar to give me a tip or clue on the best way to go about this.
Basically, I want to pick an entity in mspace to attach a leader or item balloon with the entities'  info as the text
Thanks,
Mick.
« Last Edit: December 01, 2005, 06:20:51 AM by MickD »
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Select modelspace entities in paperspace
« Reply #4 on: December 01, 2005, 06:29:49 AM »
does the ObjectARX acedTrans  transform from paperspace to wcs
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Glenn R

  • Guest
Re: Select modelspace entities in paperspace
« Reply #5 on: December 01, 2005, 07:14:42 AM »
What language would you ultimately want this in Mick?

As Kerry pointed out, there is an un-documented function to do this (dimensioning).............

Cheers,
Glenn.

Bob Wahr

  • Guest
Re: Select modelspace entities in paperspace
« Reply #6 on: December 01, 2005, 10:29:51 AM »
I did something a while back, long enough that I need to hunt and refresh, that copied from paperspace to modelspace.  It should be fairly simple to modify.  I'll try to track it down at lunch today and see what I can do with it.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Select modelspace entities in paperspace
« Reply #7 on: December 01, 2005, 10:32:52 AM »
Hi all,
Does anybody have any code examples of selecting modelspace entities in a viewport from paperspace? (without 'activating' the viewport)

or

Any ideas on the best way to achieve something like this?

TIA,
Mick.

Do you mean only selecting entities that are visible in the viewport (i.e. honoring viewport boundaries, clips, vplayer status et. al)?
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Select modelspace entities in paperspace
« Reply #8 on: December 01, 2005, 11:04:04 AM »
Michael, I'm pretty sure that is the case.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Jürg Menzi

  • Swamp Rat
  • Posts: 599
  • Oberegg, Switzerland
Re: Select modelspace entities in paperspace
« Reply #9 on: December 01, 2005, 11:33:22 AM »
Quick and dirty:
Code: [Select]
(defun MeGetEntsInVport ( / ExLoop LolPnt OffSet SelSet UprPnt VptCen VptEnl VptEnt)
 (while (not ExLoop)
  (initget " ")
  (setq VptEnt (entsel "\nSelect viewport: "))
  (cond
   ((= VptEnt "") (setq ExLoop T))
   (VptEnt
    (setq VptEnl (entget (car VptEnt)))
    (if (= (cdr (assoc 0 VptEnl)) "VIEWPORT")
     (progn
      (setq VptCen (reverse (cdr (reverse (cdr (assoc 10 VptEnl)))))
            OffSet (mapcar
                   '(lambda (l) (/ (cdr (assoc l VptEnl)) 2.0)) '(40 41)
                   )
            LolPnt (trans (mapcar '(lambda (c o) (- c o)) VptCen OffSet) 3 2)
            UprPnt (trans (mapcar '(lambda (c o) (+ c o)) VptCen OffSet) 3 2)
            ExLoop T
      )
      (setvar "TILEMODE" 1)
      (setq SelSet (ssget "_C" LolPnt UprPnt))
      (setvar "TILEMODE" 0)
     )
     (prompt " selected entity is not a viewport.")
    )
   )
   (T (prompt " 1 selected, 0 found."))
  )
 )
 SelSet
)
...Edited: Oops, wrong language
« Last Edit: December 01, 2005, 01:16:53 PM by Jürg Menzi »
A computer's human touch is its unscrupulousness!
MENZI ENGINEERING GmbH
Current A2k16... A2k24 - Start R2.18

MickD

  • King Gator
  • Posts: 3636
  • (x-in)->[process]->(y-out) ... simples!
Re: Select modelspace entities in paperspace
« Reply #10 on: December 01, 2005, 03:34:43 PM »
Thanks All for your replies.

What language would you ultimately want this in Mick?

As Kerry pointed out, there is an un-documented function to do this (dimensioning).............

Cheers,
Glenn.

Ultimately I'd like to do it in C#, the only problem with the undocumented function as pointed out it may become obselete(?).



Do you mean only selecting entities that are visible in the viewport (i.e. honoring viewport boundaries, clips, vplayer status et. al)?

Pretty much Michael, I'd like to pick an entity in ms while in ps, say a block with att's, and use its att's for an item number on a leader or item balloon.

Thanks Jürg, I haven't used lisp in a long time, I'll give it a whirl and let you know.

TA,
Mick.
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien

MickD

  • King Gator
  • Posts: 3636
  • (x-in)->[process]->(y-out) ... simples!
Re: Select modelspace entities in paperspace
« Reply #11 on: December 01, 2005, 05:43:04 PM »
Thanks again Jürg but I don't want to change spaces, maybe I ask too much.

Thinking about it though, I think I need to do a 'ray trace' of the point picked in the vp. To do this I have to find where the viewport resides in model space. find the picked point in regards to the vp in mspace, create a ray perpendicular to the vport and find what it 'hits' and grab that entity's id and process it.
Sounds easy ???

Back to the developers guide....
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien

fxcastil

  • Guest
Re: Select modelspace entities in paperspace
« Reply #12 on: December 08, 2005, 01:15:20 PM »
Did you ever get a solution to this problem. I see where you were adding balloons to paper space for items picked in model space.

I am doing the same thing , I just have a user form pop up when the user wants to add leaders with ballons , on the form is an option to pick
items in model space. The user is switched to model space to pick objects when he is done picking objects from the screen I switch back to paper space to add the leaders and balloons. I have not had complaints from users.

What did you decide to do ?

Fred Castillo

MickD

  • King Gator
  • Posts: 3636
  • (x-in)->[process]->(y-out) ... simples!
Re: Select modelspace entities in paperspace
« Reply #13 on: December 08, 2005, 04:02:36 PM »
Still working on it Fred, I've been a little distracted with work and other projects of late.
Your solution is fine as is Jürg's but I really want the items to be picked from paperspace without switching modes (or at least the user not seeeing it happen anyway ;) ). The reason is I want the user (i.e. the Drafters in my office) to pick the item and place the item balloon right next to it. This 'almost' eliminates balloons being put in the wrong places.

Hmmm, just a thought, I could probably get a list of the objects from modelspace (while in pspace), put them in a list in a dialog, select the item I want to attach balloons to which highlights the object then place the balloon next to the highlighted item.

That just might work!
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien

Arizona

  • Guest
Re: Select modelspace entities in paperspace
« Reply #14 on: December 09, 2005, 06:56:20 AM »
Mick,

If you had the Cadencoding libraries, try reading this one...CADEncoding\Archives\expresso\cafe\t-5406.html