TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Lee Mac on June 03, 2010, 07:46:50 AM

Title: Persistent Reactors Group
Post by: Lee Mac on June 03, 2010, 07:46:50 AM
How can one tell in Visual LISP if an object has a persistent reactor group attached to it?

For example in Vanilla we have:

Code: [Select]
(102 . "{ACAD_REACTORS")
(330 . <Entity name: 7ef038e0>)
(102 . "}")

What is the synonymous method in VL, if there is one?

Many thanks for your advice,

Lee
Title: Re: Persistent Reactors Group
Post by: LE3 on June 03, 2010, 10:33:15 AM
(vlr-pers-p reactor)

?
Title: Re: Persistent Reactors Group
Post by: Lee Mac on June 03, 2010, 10:35:45 AM
Thanks for your reply Luis, I had looked into the reactor functions - however, there is no reactor object to be working with - only the VLA-Object that the reactor is attached to.

Such as in the case of a Polyline Viewport  :wink:
Title: Re: Persistent Reactors Group
Post by: LE3 on June 03, 2010, 10:37:14 AM
Thanks for your reply Luis, I had looked into the reactor functions - however, there is no reactor object to be working with - only the VLA-Object that the reactor is attached to.

Such as in the case of a Polyline Viewport  :wink:
maybe ? some start...
Code: [Select]
(defun rwiz-partof  (obj / obj_reactors)
  (if (setq obj_reactors
     (cdar (vlr-reactors :vlr-object-reactor)))
    (vl-some
      (function (lambda (n) (numberp n)))
      (mapcar
(function (lambda (r) (vl-position obj (vlr-owners r))))
obj_reactors))))
Title: Re: Persistent Reactors Group
Post by: alanjt on June 03, 2010, 10:43:30 AM
Thanks for your reply Luis, I had looked into the reactor functions - however, there is no reactor object to be working with - only the VLA-Object that the reactor is attached to.

Such as in the case of a Polyline Viewport  :wink:
maybe ? some start...
Code: [Select]
(defun rwiz-partof  (obj / obj_reactors)
  (if (setq obj_reactors
     (cdar (vlr-reactors :vlr-object-reactor)))
    (vl-some
      (function (lambda (n) (numberp n)))
      (mapcar
(function (lambda (r) (vl-position obj (vlr-owners r))))
obj_reactors))))
Seems like that would only work if you selected the Viewport instead of the LWPolyline.
Title: Re: Persistent Reactors Group
Post by: alanjt on June 03, 2010, 10:45:01 AM
Nevermind, that doesn't work either...

Code: [Select]
(rwiz-partof (vlax-ename->vla-object (ssname (ssget '((0 . "VIEWPORT"))) 0)))
Title: Re: Persistent Reactors Group
Post by: Lee Mac on June 03, 2010, 10:47:31 AM
Yes, it appears that the persistent reactors associated with such objects are not listed in the reactor list.  :|
Title: Re: Persistent Reactors Group
Post by: LE3 on June 03, 2010, 10:47:50 AM
Nevermind, that doesn't work either...

Code: [Select]
(rwiz-partof (vlax-ename->vla-object (ssname (ssget '((0 . "VIEWPORT"))) 0)))
have not played with vlisp reactors in a long time.... and don't think i understood what you boys are doing... need to get my second cup of coffee here...'please explain with apples and oranges  :lol:
Title: Re: Persistent Reactors Group
Post by: alanjt on June 03, 2010, 10:51:19 AM
Nevermind, that doesn't work either...

Code: [Select]
(rwiz-partof (vlax-ename->vla-object (ssname (ssget '((0 . "VIEWPORT"))) 0)))
have not played with vlisp reactors in a long time.... and don't think i understood what you boys are doing... need to get my second cup of coffee here...'please explain with apples and oranges  :lol:
LoL
Is it possible to check and extract if any apples are associated to a selected orange (type vla-object) with persistent reactors.
 :lol:
Title: Re: Persistent Reactors Group
Post by: LE3 on June 03, 2010, 11:04:51 AM
Yes, it appears that the persistent reactors associated with such objects are not listed in the reactor list.  :|
how Alan knew about the viewport usage?.... anyway if you are using the (vlr-pers-list) that is not going to return anything only the ones you created on your namespace...afaik
Title: Re: Persistent Reactors Group
Post by: alanjt on June 03, 2010, 11:06:24 AM
Yes, it appears that the persistent reactors associated with such objects are not listed in the reactor list.  :|
how Alan knew about the viewport usage?.... anyway if you are using the (vlr-pers-list) that is not going to return anything only the ones you created on your namespace...afaik
(http://www.giantbrain.co.uk/phpBB2/templates/subSilver/images/logo_phpBB.gif)

Started from a thread over @ CADTutor.
http://www.cadtutor.net/forum/showthread.php?t=45263&page=3
Title: Re: Persistent Reactors Group
Post by: LE3 on June 03, 2010, 11:11:56 AM
Started from a thread over @ CADTutor.
oooo i seeee
maybe it can be done some arx function to add this feature... below it is what i do in a case similar to this - in lisp i'm out of date:
Code: [Select]
static void AddSideItemsOnSegment(void)
{
ads_name ename;
ads_point pt, ptWcs;
AcDbObjectId oid;
if (acedEntSel(_T("\nSelect side on heavy polyline with closed polygon: "), ename, pt) != RTNORM) return;
acdbUcs2Wcs(pt, ptWcs, Adesk::kFalse); // Convert to WCS in case selection was made while in a UCS.
acdbGetObjectId(oid, ename);

AcDbObjectPointer<AcDb2dPolyline> pOutline(oid, AcDb::kForRead);
if (pOutline.openStatus() != Acad::eOk) return;

// check if have a closed polygon attached!
bool haveClosedPoygon = false;
AcDbVoidPtrArray* pArray = pOutline->reactors();
if (pArray && pArray->length() > 0)
{
for (int i = 0; i < pArray->length(); i++)
{
void* pVoid = pArray->at(i);
if (acdbIsPersistentReactor(pVoid))
{

AcDbObjectId reactorId = acdbPersistentReactorObjectId(pVoid);
AcDbObjectPointer<csdbClosedPolygon> cPolygon(reactorId, AcDb::kForWrite); // we need to save some side data on this object!
if (cPolygon.openStatus() == Acad::eOk)
{ ...
Title: Re: Persistent Reactors Group
Post by: Lee Mac on June 03, 2010, 11:27:06 AM
Ahhh! Arx....  :cry:
Title: Re: Persistent Reactors Group
Post by: alanjt on June 03, 2010, 11:27:59 AM
Ahhh! Arx....  :cry:
X2 :cry: :cry:
Title: Re: Persistent Reactors Group
Post by: LE3 on June 03, 2010, 12:02:48 PM
Ahhh! Arx....  :cry:
X2 :cry: :cry:
:-o
did a quick test command, someone wants to tried?... (will allow to select viewports only! for A2010)
Command: TEST1

It simple will display if the selected object have persistent reactors attached - then later if works we can add the return of list of objects... will see - maybe
edit: took out the arx that was attached - reason: does not work -
Title: Re: Persistent Reactors Group
Post by: LE3 on June 03, 2010, 03:50:29 PM
tried and does not return anything.... :-(

Ahhh! Arx....  :cry:
X2 :cry: :cry:
:-o
did a quick test command, someone wants to tried?... (will allow to select viewports only! for A2010)
Command: TEST1

It simple will display if the selected object have persistent reactors attached - then later if works we can add the return of list of objects... will see - maybe
Title: Re: Persistent Reactors Group
Post by: LE3 on June 03, 2010, 10:07:21 PM
ok... did a little research on some of my old stuff:
1. The persistent data it is saved inside of the dictionary: "VL-REACTORS" or can be verified using: (vlr-pers-dictname)
2. Just call: (entget (namedobjdict)) and in there will be something: (3 . "VL-REACTORS")
3. Then it can be access with: (setq dict (dictsearch (namedobjdict) (vlr-pers-dictname)))
4. Here extract the value below: (3 . "$DOC$")
5. After extracting the 350 value something like this will be in the list:
Quote
((-1 . <Entity name: 7eeb0530>)
  (0 . "VLO-VL")
  (5 . "19E")
  (102 . "{ACAD_REACTORS")
  (330 . <Entity name: 7eeb0500>)
  (102 . "}")
  (330 . <Entity name: 7eeb0500>)
  (100 . "vlo_VL")
  (90 . -64512)
  (91 . 179)
  (92 . 4)
  (340 . <Entity name: 7eeb04f0>)
  (340 . <Entity name: 7eeb04d8>)
  (340 . <Entity name: 7eeb0520>)
  (340 . <Entity name: 7eeb0518>)
  (300
    .
    "((&VLO-C Object-Reactor ((:VLR-modified . \"MODIFIED\")) ((&VLO-A . 0)) ((&VLO-A . 1)) 0 T) (&VLO-C Object-Reactor ((:VLR-modified . \"MODIFIED\")) ((&VLO-A . 2)) ((&VLO-A . 3)) 0 T))"))
Just study those values and you can get all the data necessary... hope that now it will really going to help, not just the vs (with b) posted before by me earlier...  :oops:
Title: Re: Persistent Reactors Group
Post by: Lee Mac on June 04, 2010, 05:43:19 AM
Thanks Luis - I don't know how you managed to find it, but well done - I'll have a play around with it and investigate  8-)
Title: Re: Persistent Reactors Group
Post by: LE3 on June 06, 2010, 10:06:10 AM
Nevermind, that doesn't work either...

Code: [Select]
(rwiz-partof (vlax-ename->vla-object (ssname (ssget '((0 . "VIEWPORT"))) 0)))
and my last try...
Quote
circle, lwpolyline...
_$ (setq ent (ssname (ssget '((0 . "VIEWPORT"))) 0))
_$ (vla-get-clipped (vlax-ename->vla-object ent))
:vlax-true

viewport...
_$ (setq ent (ssname (ssget '((0 . "VIEWPORT"))) 0))
_$ (vla-get-clipped (vlax-ename->vla-object ent))
:vlax-false

or to check the value of 90 dxf