Author Topic: Is it possible to skip group command when in refedit.?  (Read 5314 times)

0 Members and 1 Guest are viewing this topic.

MvdP

  • Guest
Is it possible to skip group command when in refedit.?
« on: August 15, 2006, 04:45:48 AM »
Is it possible to bypass the group command in the follwing part of my routine when i am in a refedit.(** GROUP command not allowed during reference editing **)
Code: [Select]
(defun h1 ()
(command "LAYER" "on" "z-arc" "")
(command "bhatch" "p" pat sca hk0 "s" "L" "" "")
(setq arcering (entlast))
(setq ed (entget arcering))   
  (setq ed (subst (cons 8 "00---0-a_Arceer") (assoc 8 ed) ed ))
  (entmod ed)
 
(setq groepgetal (rtos (getvar "CDATE") 2 9))
(setq groepnaam (substr groepgetal 10 9))

  (if (= arcx nil)
(progn
(command "-group" "c" groepnaam "" arcering omranding "")
  )
)

  (command "layer" "off" "z-arc" "")
(setq c (entlast))
(command "draworder" c "" "back")


)
« Last Edit: August 15, 2006, 11:07:15 AM by MvdP »

CADaver

  • Guest
Re: Is it possible to skip group command when in refedit.?
« Reply #1 on: August 15, 2006, 04:33:06 PM »
You could check for CMDACTIVE?  Won't be specifically REFEDIT, but if a command is active, skip the "group".

MvdP

  • Guest
Re: Is it possible to skip group command when in refedit.?
« Reply #2 on: August 16, 2006, 02:11:22 AM »
Thanks CADaver this is what i did.


Code: [Select]
;hatches the poly-line
(defun h1 ()
(command "LAYER" "on" "z-arc" "")
(command "bhatch" "p" pat sca hk0 "s" "L" "" "")
(setq arcering (entlast))
(setq ed (entget arcering))   
  (setq ed (subst (cons 8 "00---0-a_Arceer") (assoc 8 ed) ed ))
  (entmod ed)
 
(setq groepgetal (rtos (getvar "CDATE") 2 9))
(setq groepnaam (substr groepgetal 10 9))

  (if (= arcx nil)
(progn
(command "-group" "c" groepnaam "" arcering omranding "")(while ( =1 (getvar "CMDACTIVE")))
  )
)

  (command "layer" "off" "z-arc" "")
(setq c (entlast))
(command "draworder" c "" "back")


)

But it doesn't skip the group command what am i doing wrong here.?

MvdP

  • Guest
Re: Is it possible to skip group command when in refedit.?
« Reply #3 on: August 23, 2006, 01:48:50 AM »
Nobody.?

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Is it possible to skip group command when in refedit.?
« Reply #4 on: August 23, 2006, 03:59:46 AM »
Where is the value for this being set ..

(if (= arcx nil)
....

NB: could use this

(if (not ARCX)
....

<standard code failure fixer 6A> make the variables local,

what happens then ...


... don't have time to look at your real problem ..
.. but, can you explain how you believe this works ..
      (progn
         (command "-group" "c" groepnaam "" arcering omranding "")(while ( =1 (getvar "CMDACTIVE")))
        )
« Last Edit: August 23, 2006, 04:03:34 AM by Kerry Brown »
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.

MvdP

  • Guest
Re: Is it possible to skip group command when in refedit.?
« Reply #5 on: August 23, 2006, 04:12:44 AM »

Quote
.. but, can you explain how you believe this works ..
      (progn
         (command "-group" "c" groepnaam "" arcering omranding "")(while ( =1 (getvar "CMDACTIVE")))
        )

No i can't explain it.That is why i am asking how to do this so it will work.

(arcx is not being set it.this line is unnecessary.And i took it out.!!)
« Last Edit: August 23, 2006, 04:23:41 AM by MvdP »

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Is it possible to skip group command when in refedit.?
« Reply #6 on: August 23, 2006, 05:31:47 AM »
If you bother to test it, the CMDACTIVE variable is still 0 when Refedit is active.
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.

MvdP

  • Guest
Re: Is it possible to skip group command when in refedit.?
« Reply #7 on: August 23, 2006, 05:42:52 AM »
I did bother to test it.

So does this mean my question is impossible to achieve.
« Last Edit: August 23, 2006, 05:49:05 AM by MvdP »

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Is it possible to skip group command when in refedit.?
« Reply #8 on: August 23, 2006, 05:57:28 AM »
(command "LAYER" "on" "z-arc" "")
Why are you turning this ON, or do you want it current ? you appear to NOT use the Layer.

(command "bhatch" "p" pat sca hk0 "s" "L" "" "")
what are the values for the variables passed to the bhatch command
Note that the conventional call is "-BHATCH" <with a hyphen> to ensure supression of the dialog,
similarly for "-LAYER"

omranding
What is the value of this variable ?


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.

MvdP

  • Guest
Re: Is it possible to skip group command when in refedit.?
« Reply #9 on: August 23, 2006, 06:07:40 AM »
Let me try to explain what this routine is doing.
It asks to  select two lines and than the routine creates a boundary on layer z-arc hatches the boundary with a pattern (defined in button) and create a group of the two objects.So when i pick the hatch or boundary the complete group is deleted.
This is working perfect but when in refedit autocad cannot create a group and returns an error.So that is why i am asking if it possible to skip the make group command when in refedit. If it is not possible to detect this somehow i have to found another way.And i think the easiest way is to leave the make group command out of this routine
« Last Edit: August 23, 2006, 06:10:34 AM by MvdP »

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Is it possible to skip group command when in refedit.?
« Reply #10 on: August 23, 2006, 07:09:21 AM »
(getvar "refeditname")

""

or

the name of the reference being edited
« Last Edit: August 23, 2006, 07:10:50 AM by Kerry Brown »
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.

MvdP

  • Guest
Re: Is it possible to skip group command when in refedit.?
« Reply #11 on: August 23, 2006, 08:14:51 AM »
Ok but to do when refedit can be any block.?And where do i put it in this.?

This what i did but it aint working.

Code: [Select]
(setq refname (getvar "refeditname"))(while (<> refname nil ))(command "-group" "c" groepnaam "" arcering omranding "")


Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Is it possible to skip group command when in refedit.?
« Reply #12 on: August 23, 2006, 08:36:50 AM »
You could try something like :

Code: [Select]
(IF
  (= (STRLEN (GETVAR "refeditname")) 0)
   (COMMAND "-group"   "c"
            groepnaam  ""
            arcering   omranding
            ""
           )
)
« Last Edit: August 23, 2006, 08:58:48 AM by Kerry Brown »
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.

daron

  • Guest
Re: Is it possible to skip group command when in refedit.?
« Reply #13 on: August 23, 2006, 08:38:42 AM »
Another question? What is setting this: omranding variable. If it's empty or nil, can the command still work? Also, is there any reason that the layer z-arc wouldn't exist? Just a thought here, but if it didn't exist, turning it one would merely crash your routine from the start. Just to be clear, you might consider using (layer make z-arc), then turning it on and making sure it's thawed and unlocked. Using make will either create it if it doesn't exist and set it as the current layer, or just set it as the current layer if it does already exist. If you don't wish to have it set as the current layer, you should still employ the above to make sure all possible issues are resolved, then set the desired layer. As for the real problem, do you want to test for refname NOT nil, meaning you're in a refedit command, or (refname nil)? Also, and maybe this is me getting here late, but why are you using while here?

MvdP

  • Guest
Re: Is it possible to skip group command when in refedit.?
« Reply #14 on: August 23, 2006, 08:51:49 AM »
Kerry.

I tried your code and it not skipping the group command.

Daron.

You have a lot of guestions and remarks, and i can you tell you that the whole routine is working except the skipping part.And the answer for the last question is the following.I want the routine to skip the making of a group when i am in a refedit no mather what block i am editing.And how to do this i don't know.