Author Topic: DesignCad drives me crazy  (Read 3041 times)

prl

  • Hero Member
  • *****
  • Posts: 3389
  • A Bézier Extrusion
Re: DesignCad drives me crazy
« Reply #15 on: December 08, 2014, 10:47:10 AM »
Juergen, reconsidering your code snippet, I was wrong.  It shouldn't work.  You are looping a selection set (where everything has the selection flag as 1) and you're telling basiccad to set the selection flag for type 13 text to 1.  It is already that! You will need to do the array method storing the entity ids, then deselect all setting the selection property to 0 for all, then process the entities array looking for type 13 entities, setting the selection property to 1 then erase the new selection set (having only type 13 entities). 

Note I've added the colobylayer flag setting in the getselect loop.


Alias ENT_COLORBYLAYER        &H0117  'R/W - b

dim ent(10000)
.
.
.
maxsel = sys(80)

for j = 1 to maxsel
  getselect j, ent(j) 'get entity numbers and store in array
  entity ent(j)
  change Ent_ColorByLayer, 0
next j

sys(80)=0
 
for i = 1 to maxsel
  GetAttr ent(i), type, select
  if type = 13 then PutAttr ent(i), type, 1
next i

if sys(80) >0 then
  >erase
  {
  }
endif

sys(36)=0
.
.
.

« Last Edit: December 08, 2014, 11:28:50 AM by prl »

Juergen

  • Jr. Member
  • **
  • Posts: 94
Re: DesignCad drives me crazy
« Reply #16 on: December 08, 2014, 10:57:12 AM »
Prl,

Please note your pm.

Juergen

prl

  • Hero Member
  • *****
  • Posts: 3389
  • A Bézier Extrusion
Re: DesignCad drives me crazy
« Reply #17 on: December 08, 2014, 11:26:32 AM »
Ha, ha.  Ooh la la, wenn Französinnen  :D - deutsch sprechen.  Ja, danke. Ein wenig Deutsch auf diesem Board kann nicht schaden, aber im Allgemeinen, die alten Jungs hier lieben Englisch wenn sie nicht schnarchen.   Mal sehen, how lange es takes for sie to decode gemischte Sprachen.

Pretty straight forward, no?

Juergen

  • Jr. Member
  • **
  • Posts: 94
Re: DesignCad drives me crazy
« Reply #18 on: December 08, 2014, 11:35:18 AM »
Quote
Mal sehen, how lange es takes for sie to decode gemischte Sprachen.

It takes a second with Google and both directions (translations DE/EN) are pretty good!

Dr PR

  • Hero Member
  • *****
  • Posts: 5398
Re: DesignCad drives me crazy
« Reply #19 on: December 08, 2014, 12:55:52 PM »
prl,

Es ist vor funfzig Jahren als ich Deutsch studiert haben, aber dieser alten Jung kann entschlussen diener leicht angebrochen Deutch - mehr oder weiniger.

Aber, ich eingestehen mein englisch ist viel besser als mein deutsch!

Phil
« Last Edit: December 09, 2014, 10:30:55 AM by Dr PR »
DesignCAD user since 1987

Dempsey

  • Hero Member
  • *****
  • Posts: 1890
  • Intel i7-960, 12GB, NVidiaGTX570, Win7x64, DC26.2
    • World of van Vliet
Re: DesignCad drives me crazy
« Reply #20 on: December 08, 2014, 02:35:33 PM »
I speak every language in the world, except Chinese. The above sounds like Chinese to me...  ;D
Dempsey

prl

  • Hero Member
  • *****
  • Posts: 3389
  • A Bézier Extrusion
Re: DesignCad drives me crazy
« Reply #21 on: December 09, 2014, 12:14:20 AM »
I speak every language in the world

An off-topic wandering, but they say humans of the future will have a hybrid neocortex, the one you have and an embedded at birth GoogleTmBabble connection.  Or maybe no talking or writing is necessary between the new hybrid Humans, they just upload to each other.

« Last Edit: December 09, 2014, 12:16:02 AM by prl »

Dempsey

  • Hero Member
  • *****
  • Posts: 1890
  • Intel i7-960, 12GB, NVidiaGTX570, Win7x64, DC26.2
    • World of van Vliet
Re: DesignCad drives me crazy
« Reply #22 on: December 09, 2014, 07:35:15 PM »
prl,

This what I wrote in 2001: http://www.van-vliet.org/crazyworld.shtml#irobot
Dempsey

prl

  • Hero Member
  • *****
  • Posts: 3389
  • A Bézier Extrusion
Re: DesignCad drives me crazy
« Reply #23 on: December 10, 2014, 12:44:18 AM »
This what I wrote in 2001: http://www.van-vliet.org/crazyworld.shtml#irobot

Dempsey . . . . that 20 something neighbor is now +/- 35.  But that isn't so bad is it?  And reading the rest of your page . . . .  DesignCAD 24 is Essentially complete.

DesignCAD CHIMP 3D CAD, now with random logic function.   :)  You guys knew I had to bring this back to DC somehow.

Juergen, did you get the basiccad code snippet to do what you need?
« Last Edit: December 10, 2014, 01:50:47 AM by prl »

Juergen

  • Jr. Member
  • **
  • Posts: 94
Re: DesignCad drives me crazy
« Reply #24 on: December 10, 2014, 12:13:12 PM »
Hi Prl,

sorry for being late, I was out.
Currently I use this snippet:

Alias T_TEXT               &H050A
maxsel = sys(80)

'get entity numbers and store in array
for j = maxsel to 1 Step -1
  getselect j, entid
  entity entid
 
If  Sys(90) = 13 Then Change T_Text, " "

 
change Ent_ColorByLayer, 0
next j

I am not so happy with the double loops in #15 and the
dim ent(10000) for now. The snippet above works fine.
I'll go on testing next weekend.

Right now I'm struggling with a new topic to solve first.
I'll open a new post on this.

Kind regards,

Juergen

prl

  • Hero Member
  • *****
  • Posts: 3389
  • A Bézier Extrusion
Re: DesignCad drives me crazy
« Reply #25 on: December 10, 2014, 11:47:25 PM »
I am not so happy with the double loops in #15 and the
dim ent(10000) for now.

Add these thoughts to your future toolbox, many ways to do the same thing.


Using a trash layer
.
.
.
TrashL = 999 'a dedicated trash layer
maxsel = sys(80)

for j = 1 to maxsel
  getselect j, entid
  entity entid
  change Ent_ColorByLayer, 0
  GetAttr entid, type, select
  if type = 13 then
     PutAttr entid, type, select, 999
  endif
next j

'delete everything on the trash layer
>SelectLayer
{
<type 0
<layer [TrashL]
}

if sys(80) >0 then
  >erase
  {
  }
endif
.
.
.



Using the double loops - note the array is dimensioned to the selected set size

maxsel = sys(80)
dim ent(maxsel)
for j = 1 to maxsel
  getselect j, ent(j) 'get entity numbers and store in array
  change Ent_ColorByLayer, 0
next j

sys(80)=0
 
for i = 1 to maxsel
  GetAttr ent(i), type, select
  if type = 13 then PutAttr ent(i), type, 1
next i

if sys(80) >0 then
  >erase
  {
  }
endif
« Last Edit: December 11, 2014, 12:12:17 AM by prl »

prl

  • Hero Member
  • *****
  • Posts: 3389
  • A Bézier Extrusion
Re: DesignCad drives me crazy
« Reply #26 on: December 11, 2014, 12:04:03 AM »
I guess type is reserved as part of the statement:

PUTATTR entity, type, {,select, laynum, group, red, green, blue, solid}

Regarding your quote, as far as I know, all the arguments for the PuttAttr statement are variables.  It is the programmer's responsibility to ensure they contain valid data. Hence I usually precede a PutAttr with a GetAttr statement.   But you can change the variable data as you wish,  though you may get nonsense (say you change a line type into text type).

The below is an example of something that is compatible (lines and planes).

Code: [Select]
' Program: prlmp.d3m (prl make plane from line entity)

'a test routine
getselect 1, ent

getattr ent, type, select, laynum, grouporig, rc, gc, bc

if type = 1 then
   'change the line to a plane
   type = 31
   putattr ent, type, 1, laynum, grouporig, rc, gc, bc,
endif
 
regen

End
« Last Edit: December 11, 2014, 12:10:11 AM by prl »

Juergen

  • Jr. Member
  • **
  • Posts: 94
Re: DesignCad drives me crazy
« Reply #27 on: December 11, 2014, 12:22:16 PM »
Quote
Add these thoughts to your future toolbox, many ways to do the same thing.

Prl, you are really our 'DC Hero'. I wonder where this specific knowledge is coming from ;)
Thanks for sharing this all the time. It takes hours to find almost comparable solutions.

Kind regards,

Juergen