CoCreate User Forum  

Go Back   CoCreate User Forum > Applications > CoCreate Drafting

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 06-02-2015, 09:14 AM
painaz painaz is offline
Registered User
 
Join Date: Jun 2015
Posts: 2
GATHERING parts with same name part

i'm tryng to came up with a macro gathering parts with same part name.

I wrote this:

DEFINE unifica

local riga_tabella
local nome_parte_corrente
local id_parte_corrente
local nome_parte_confronto
local id_parte_confronto
LOCAL lista_parti

inq_env 7
let nome_parte_corrente (inq 301)
let nome_parte_corrente (TRIM nome_parte_corrente)
let nome_parte_corrente (SUBSTR nome_parte_corrente 1 8)

inq_env 7
let id_parte_corrente (inq 302)
{ let id_parte_corrente ("~"+ STR id_parte_corrente) }



pb_ltab_update

LET lista_parti 'PBT_LTAB'
let riga_tabella 1

LOOP
LET riga_tabella (riga_tabella+1)
EXIT_IF (riga_tabella>(LTAB_ROWS lista_parti))
let nome_parte_confronto (READ_LTAB lista_parti riga_tabella 1)
let nome_parte_confronto (TRIM nome_parte_confronto)
let nome_parte_confronto (SUBSTR nome_parte_confronto 1 8)
let id_parte_confronto (READ_LTAB lista_parti riga_tabella 2)
{ let id_parte_confronto ("~"+ STR id_parte_confronto) }

if (id_parte_corrente <> id_parte_confronto)
if (nome_parte_corrente = nome_parte_confronto)
EDIT_PART TOP
GATHER id_parte_confronto
EDIT_PART id_parte_corrente
GATHER id_parte_confronto
SMASH_SUBPART id_parte_confronto
pb_ltab_update
LET lista_parti 'PBT_LTAB'
end_if
end_if
let riga_tabella (riga_tabella + 1)
END_LOOP
end
end
edit_part top

The "funny" thing is that the loop

..
EDIT_PART TOP
GATHER id_parte_confronto
EDIT_PART id_parte_corrente
GATHER id_parte_confronto
SMASH_SUBPART id_parte_confronto
pb_ltab_update
LET lista_parti 'PBT_LTAB'
..

works fine if i insert each command using command line imput, fails if i lunch the macro

Any idea?

P.S. I'm not english mother toungue. I beg your pardon for my english.
Reply With Quote
  #2  
Old 06-04-2015, 08:49 AM
painaz painaz is offline
Registered User
 
Join Date: Jun 2015
Posts: 2
Re: GATHERING parts with same name part

i found a solution, works fine. I'd like share it:

DEFINE unifica

local riga_tabella

local nome_parte_corrente
local id_parte_corrente
local id_parte_corrente_num

local nome_parte_confronto
local id_parte_confronto
local id_parte_confronto_num

local lista_parti

inq_env 7
let nome_parte_corrente (inq 301)
let nome_parte_corrente (TRIM nome_parte_corrente)
{let nome_parte_corrente (SUBSTR nome_parte_corrente 1 8)}

inq_env 7
let id_parte_corrente (inq 302)
let id_parte_corrente (STR "~"+id_parte_corrente)
{ let id_parte_corrente_num (NUM id_parte_corrente_str) }

EDIT_PART TOP

pb_ltab_update
LET lista_parti 'PBT_LTAB'
LET riga_tabella (1)

while ( riga_tabella <= ltab_rows "PBT_LTAB" )
let nome_parte_confronto (READ_LTAB "PBT_LTAB" riga_tabella 1)
let nome_parte_confronto (TRIM nome_parte_confronto)
{let nome_parte_confronto (SUBSTR nome_parte_confronto 1 8)}
let id_parte_confronto (READ_LTAB "PBT_LTAB" riga_tabella 2)
{ let id_parte_confronto_num (NUM id_parte_confronto_str) }
if (id_parte_corrente = id_parte_confronto)
{ display ("=") }
else
{ display ("entro in else") }
{ display (id_parte_corrente) }
{ display (id_parte_confronto) }
{ display (nome_parte_corrente) }
{ display (nome_parte_confronto) }
if (nome_parte_corrente = nome_parte_confronto)
TRAP_ERROR
{ display ("unifico") }
EDIT_PART TOP
GATHER id_parte_confronto
EDIT_PART id_parte_corrente
GATHER id_parte_confronto
SMASH_SUBPART id_parte_confronto
end_if
end_if
let riga_tabella (riga_tabella + 1)
end_while
edit_part top
END_DEFINE
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 07:34 AM.



Hosted by SureServer    Forums   Modeling FAQ   Macro Site   Vendor/Contractors   Software Resellers   CoCreate   Gallery   Home   Board Members   Regional User Groups  By-Laws  

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.