What's new

Can you drive text input in sketches at the Dynamic Library/ Excel- driven Toolbox etc level?

tuyere

New Member
For work I frequently have to create parametrically-driven models and assemblies with many variants available. It's reasonably painless to generate almost everything using toolbox additions. So good, so far. The only big hurdle I've hit so far is with labelling- these are 3D printed parts that need to have labels and titles embossed or wrapped onto a model, with each variant needing its own slightly-different text. Think making a family of radius gages, with every gage featuring a radius identifier. Sometimes the variants will be longer alphanumeric sequences. Is there any way I can control the text input at this level? Doesn't have to be excel-driven, any method suitable to batch-generation of part families would be great. I might have overlooked something, I don't know.
Currently the least painful way I know of is to generate a sketch + extrude operation for each variant, manually editing a single number for each one, and then suppressing everything except the correct label-adding feature. This is fine for a half-dozen parts, but I have a project that will need maybe 60 variants, and creating the text features is going to take 10 times longer than the rest of the process combined. It's especially frustrating because absolutely nothing about the variant sketches will differ except for one or two characters being altered- same font, same size, same everything except a 23 gets changed to a 24. Creating said sketches as catalog items can save a little bit of time, but the specifics of the labels differ between part families, so I generally can't reuse them between projects, like in this case.
One other very crufty workaround I haven't tried yet is drawing digits by creating a sixteen-segment display alphanumeric part, with each segment a separate extrusion, and then defining an alphanumeric 'part library' by suppressing or unsuppressing the various segments, so I can choose each character from a drop-down menu. Technically viable and faster to populate large part families with than the above slow method, but you're giving up on using proper fonts with good readability, and text of any length will make assemblies hideously bloated and slow to work with, so I'd rather not implement this if possible.
 

HaroldL

Alibre Super User
While I was working with SolidWorks I had occasion to link the files' part number to a text label, extrude cut feature, that was to be stamped into the part. That functionality is not available in Alibre so some other workflow is needed to accomplish what you want. Ideally, Alibre Dev would add that capability to Alibre Design at all levels.

Are you using configurations? Only issue is that you need a new sketch/feature for each number change.
1720817526790.png

For each config I Projected the text sketch from the 1st config and edited it for the 2nd and 3rd.
 

Attachments

  • pn changes.AD_PRT
    4.9 MB · Views: 2
Last edited:

NateLiquidGravity

Alibre Super User
You could try using API. You would need to create a template part as text figures can not currently be made by the API but they can be modified. In this post I shared an AlibreScript that uses the API to do just that.
 

stepalibre

Alibre Super User
You could try using API. You would need to create a template part as text figures can not currently be made by the API but they can be modified. In this post I shared an AlibreScript that uses the API to do just that.
Still working, so far?
1720841672869.png
 

stepalibre

Alibre Super User
For work I frequently have to create parametrically-driven models and assemblies with many variants available. It's reasonably painless to generate almost everything using toolbox additions. So good, so far. The only big hurdle I've hit so far is with labelling- these are 3D printed parts that need to have labels and titles embossed or wrapped onto a model, with each variant needing its own slightly-different text. Think making a family of radius gages, with every gage featuring a radius identifier. Sometimes the variants will be longer alphanumeric sequences. Is there any way I can control the text input at this level? Doesn't have to be excel-driven, any method suitable to batch-generation of part families would be great. I might have overlooked something, I don't know.
Currently the least painful way I know of is to generate a sketch + extrude operation for each variant, manually editing a single number for each one, and then suppressing everything except the correct label-adding feature. This is fine for a half-dozen parts, but I have a project that will need maybe 60 variants, and creating the text features is going to take 10 times longer than the rest of the process combined. It's especially frustrating because absolutely nothing about the variant sketches will differ except for one or two characters being altered- same font, same size, same everything except a 23 gets changed to a 24. Creating said sketches as catalog items can save a little bit of time, but the specifics of the labels differ between part families, so I generally can't reuse them between projects, like in this case.
One other very crufty workaround I haven't tried yet is drawing digits by creating a sixteen-segment display alphanumeric part, with each segment a separate extrusion, and then defining an alphanumeric 'part library' by suppressing or unsuppressing the various segments, so I can choose each character from a drop-down menu. Technically viable and faster to populate large part families with than the above slow method, but you're giving up on using proper fonts with good readability, and text of any length will make assemblies hideously bloated and slow to work with, so I'd rather not implement this if possible.
This is basically a labeling, stamping or watermarking procedure. Great timing, I need to build a system for structural steel projects. The text will be in 2D and 3D for 100's to 1'000's of unique pieces. AD, Rhino/Grasshopper and Dynamo will run in headless, command line modes. I'm not sure if I'll use AD + Rh/Gh, Dynamo or both.

With this data, not the actual BOM but a simplified version:

Item Label/Stamp,Description,Material Specification,Quantity,Unit,Weight (kg),Remarks
1,B1,I-Beam,ASTM A992,20,pcs,100,Main structural beams
2,C1,HSS (Hollow Structural Section),ASTM A500 Grade B,50,pcs,800,Columns
3,A1,Angle Iron,ASTM A36,100,pcs,600,Bracing
4,CH1,Channel,ASTM A36,100,pcs,450,Secondary beams
5,P1,Plate,ASTM A36,10,pcs,100,Base plates
6,B2,Bolt (M20),ASTM A325,100,pcs,500,Connection bolts
7,W1,Weld Material (E70),AWS A5.1,100,kg,For welding joints
8,P2,Paint,Zinc-Rich Primer,200,liters,Corrosion protection
9,S1,Galvanized Steel Sheets,ASTM A653,100,sqm,Roofing and siding
10,AB1,Anchor Bolts,ASTM F1554 Grade 55,100,pcs,100,Foundation anchors

The program will get an item (1), get the Label/Stamp (B1) for that item, get the stamp location and finally stamp "B1" on item 1.

Here are some ideas. I'm not sure if they'll work for you or how it fits into your workflow.

I recommend making a spreadsheet where everything can be developed in one place. Group models by type, size or some defined attribute. If you have 60 variants how many properties a variant can have? Is a variant a part configuration? These questions should be answered in the spreadsheet.

60 variants?:
Variant,Property1,Property2,Property3,Property4,Property5,Property6,Property7,Property8,Property9,Property10,Property11,Property12,Property13,Property14,Property15,Property16,Property17 Variant1,Value71,Value72,Value73,Value74,Value75,Value76,Value77,Value78,Value79,Value710,Value711,Value712,Value713,Value714,Value715,Value716,Value717,Value718,Value719,Value720
...
Variant60,Value91,Value92,Value93,Value94,Value95,Value96,Value97,Value98,Value99,Value910,Value911,Value912,Value913,Value914,Value915,Value916,Value917,Value918,Value919,Value920

I add comments to equations in files as a data field. You can create a Stamp/Label index lookup table where you match an equation parameter property to your text string for AD_SKETCHTEXT figure:

1720848041953.png
This technique is used in localizing text strings for translation basically find and replace.

You would need to use the script Nate made as an example to update the text figure value with the equation property shown as Variant1, Variant2 or LABEL_CODE comment value.

There are other techiques - add data to file properties then update the text figure with the property value:

1720848393848.png

I would try custom properties first.

You'll then need to use the API to get/set property values to update your text figures:

Some discussion about accessing properties:


Your file paths can include the input text string by encoding it in the path then having a lookup table that will get the actual value. How you name your parts and configurations can be used with a lookup table.

A txt file can be the database with the input text values and the part, assembly or configuration to update the text figures using a script.

each variant, manually editing a single number for each one,
This will happen in code either as a script, an addon, or external program combined with the examples I show.

So a lookup table or database with the input text values that is linked to or associated with a part, assembly or configuration is where I would start.
 

stepalibre

Alibre Super User
This is basically a labeling, stamping or watermarking procedure. Great timing, I need to build a system for structural steel projects. The text will be in 2D and 3D for 100's to 1'000's of unique pieces. AD, Rhino/Grasshopper and Dynamo will run in headless, command line modes. I'm not sure if I'll use AD + Rh/Gh, Dynamo or both.

With this data, not the actual BOM but a simplified version:

Item Label/Stamp,Description,Material Specification,Quantity,Unit,Weight (kg),Remarks
1,B1,I-Beam,ASTM A992,20,pcs,100,Main structural beams
2,C1,HSS (Hollow Structural Section),ASTM A500 Grade B,50,pcs,800,Columns
3,A1,Angle Iron,ASTM A36,100,pcs,600,Bracing
4,CH1,Channel,ASTM A36,100,pcs,450,Secondary beams
5,P1,Plate,ASTM A36,10,pcs,100,Base plates
6,B2,Bolt (M20),ASTM A325,100,pcs,500,Connection bolts
7,W1,Weld Material (E70),AWS A5.1,100,kg,For welding joints
8,P2,Paint,Zinc-Rich Primer,200,liters,Corrosion protection
9,S1,Galvanized Steel Sheets,ASTM A653,100,sqm,Roofing and siding
10,AB1,Anchor Bolts,ASTM F1554 Grade 55,100,pcs,100,Foundation anchors

The program will get an item (1), get the Label/Stamp (B1) for that item, get the stamp location and finally stamp "B1" on item 1.

Here are some ideas. I'm not sure if they'll work for you or how it fits into your workflow.

I recommend making a spreadsheet where everything can be developed in one place. Group models by type, size or some defined attribute. If you have 60 variants how many properties a variant can have? Is a variant a part configuration? These questions should be answered in the spreadsheet.

60 variants?:
Variant,Property1,Property2,Property3,Property4,Property5,Property6,Property7,Property8,Property9,Property10,Property11,Property12,Property13,Property14,Property15,Property16,Property17 Variant1,Value71,Value72,Value73,Value74,Value75,Value76,Value77,Value78,Value79,Value710,Value711,Value712,Value713,Value714,Value715,Value716,Value717,Value718,Value719,Value720
...
Variant60,Value91,Value92,Value93,Value94,Value95,Value96,Value97,Value98,Value99,Value910,Value911,Value912,Value913,Value914,Value915,Value916,Value917,Value918,Value919,Value920

I add comments to equations in files as a data field. You can create a Stamp/Label index lookup table where you match an equation parameter property to your text string for AD_SKETCHTEXT figure:

View attachment 42184
This technique is used in localizing text strings for translation basically find and replace.

You would need to use the script Nate made as an example to update the text figure value with the equation property shown as Variant1, Variant2 or LABEL_CODE comment value.

There are other techiques - add data to file properties then update the text figure with the property value:

View attachment 42185

I would try custom properties first.

You'll then need to use the API to get/set property values to update your text figures:

Some discussion about accessing properties:


Your file paths can include the input text string by encoding it in the path then having a lookup table that will get the actual value. How you name your parts and configurations can be used with a lookup table.

A txt file can be the database with the input text values and the part, assembly or configuration to update the text figures using a script.


This will happen in code either as a script, an addon, or external program combined with the examples I show.

So a lookup table or database with the input text values that is linked to or associated with a part, assembly or configuration is where I would start.
I forgot about database and dummy files:

These are Alibre files that contain only data - equations in part and global configurations. Not is not a technique I use in other CAD apps. You can use the file a lot of ways.

1720852780330.png
1720852832373.png
Example of database file inside an assembly.
1720918345268.png
 
Last edited:

HaroldL

Alibre Super User
@stepalibre , what you are describing looks to need some "advanced" programming skills that, if I were to hazard a guess, not a lot of CAD designers have. Or maybe that's just me.
It would be a real benefit it Alibre were to add some of the functions that you are working on. Maybe after PDM get launched but that likely depends on what Development has on deck for the next round of updates.
 

stepalibre

Alibre Super User
@stepalibre , what you are describing looks to need some "advanced" programming skills that, if I were to hazard a guess, not a lot of CAD designers have. Or maybe that's just me.
It would be a real benefit it Alibre were to add some of the functions that you are working on. Maybe after PDM get launched but that likely depends on what Development has on deck for the next round of updates.

PDM is huge. Many issues can be solved by PDM. I can't wait to see a feature list.

I don't assume what users know or don't know. Everyone has a background and can learn anything, I stick to sharing ideas and my thoughts. Other CAD apps have database connections and more robust library and toolbox features built-in with full API access. Alibre doesn't have a lot of the features that big CAD apps have, but it's still very powerful and capable in its own way. You need to think outside the box, be creative, and build your own solutions as the complexity of your work or a project increases. It can be better for you to build your own solutions than to use built-in features over which you have no control. I build my own solutions for important work and projects to get the precise output I want.

Many things simply don't have ready made solutions available, so you have to build them from scratch.

"advanced" programming skills that, if I were to hazard a guess, not a lot of CAD designers have.
I wonder how many Alibre users, are active on the forum? I would guess less than half. There may be more CAD designers with "advanced programming skills" who aren't active on the forum or they don't use Alibre Design.
 

HaroldL

Alibre Super User
I wonder how many Alibre users, are active on the forum? I would guess less than half.
You may be right.

There may be more CAD designers with "advanced programming skills" who aren't active on the forum or they don't use Alibre Design.
I was basing my comment on my limited experience. Thinking back on the when I was working, we had, in the local plant, about 100 designer/drafters using SolidWorks. We also had a very few that could program anything with Visual Basic. But we only had a couple that would create VB scripts for special purposes.
 

Cator

Senior Member
Buona domenica a tutti,

con la gentile autorizzazione di Nate, citando il suo post precedente e, cosa ancora più importante, il suo pubblico, uno script che utilizza una tabella Excel molto semplice per creare Testo variabile.
Può creare un'altissima probabilità che le parti facciano riferimento a un nome o a un numero di serie che in precedenza popolava la prima colonna di un foglio di lavoro.
Ho creato una versione per far funzionare lo script con un PC che supporta la lingua inglese, ma mi affido a chi è più esperto di me per pulire il codice e correggere eventuali bug.

La sequenza del lavoro è questa

1-Creare la parte.
2-Abbozza il testo e l'ancoraggio come necessario per un pezzo di dati che può cambiare (solitamente il centro)
3-Crea un file xlsx popolato con i dati nella prima colonna. Lo script scorre automaticamente la colonna e salta tutte le celle vuote
4-Apri lo script e seleziona il testo dello schizzo da Design Explorer. Quindi seleziona il file xlsx a cui collegarti.
5-Se si seleziona il formato di esportazione e si lascia NESSUNO, la configurazione del branding verrà esportata con il suo nome in una cartella definita dall'utente.

In ogni caso, lo script creerà tante quantità quanti sono i dati contenuti nella tabella, utilizzandole per nome.
Ho avuto problemi a rendere il codice internazionale, a causa della richiesta di nomi di fogli e di quello che immaginavo fosse un bug o un errore nell'elaborazione IGES. Quando selezioni questo formato, i file vengono salvati nel formato igs.
Spero di essere stato chiaro, ma allego una parte molto semplice, con il banalissimo file xlsx che potrebbe aiutare a comprendere il mio flusso di lavoro, sperando che possa essere ulteriormente migliorato.

Un saluto,
Francesco

Non sono riuscito a caricare direttamente lo script, ora l'ho compresso nella cartella variable-Text EN.zip.....
 

Attachments

  • DatabaseCartel1.xls
    28.5 KB · Views: 2
  • Example Variable Text.AD_PRT
    3.9 MB · Views: 1
  • Variable Text-EN.zip
    1.6 KB · Views: 0
Last edited:

stepalibre

Alibre Super User
Happy Sunday everyone,

with Nate's kind permission, citing his previously mentioned post and more importantly his audience, a script that uses a very simple Excel table to create Variable Text.
It can create a very high probability of parts referencing a name or serial number that previously populated the first column of a worksheet.
I created a version to make the script work with a PC that supports the English language, but I rely on those who are more experienced than me to clean the code and fix any bugs.

The sequence of work is this

1-Create the part.
2-Sketch the text and anchor as needed for a piece of data that can change (usually the center)
3-Create an xlsx file populated with the data in the first column. The script automatically scrolls the column and skips all blank cells
4-Open the script and select the sketch text from Design Explorer. Then select the xlsx file to link to.
5-If you select the export format and leave NONE, the branding configuration will be exported with its name to a user-defined folder.

In any case, the script will create as many quantities as the data contained in the table, using them by name.
I had trouble rendering the code international, due to the prompt for sheet names and what I imagined was a bug or twist in the IGES processing. When you select this format, files are saved in the igs format.
I hope I have been clear, but I attach a very simple part, with the very banal xlsx file which could help to understand my workflow, hoping that it can be further improved.

A greeting,
Francesco

Thanks for sharing, this is exactly what I'm referring to here:

A txt file can be the database with the input text values and the part, assembly or configuration to update the text figures using a script.

Some questions:

Can you share the script?
Does configurations change the text? What data will change in each configuration?

1720957331796.png
 
Last edited:

Cator

Senior Member
Thanks for sharing, this is exactly what I'm referring to here:



Some questions:

Can you share the script?
Does configurations change the text? What data will change in each configuration?

View attachment 42202
Hi Stephen,
I updated the attached files and the script is inside the compressed folder. I had a lot of problems uploading attachments.
Regarding the script, each configuration has a different sketch. As you can see, in this case, I hooked the "pilot" sketch to the center, with a coincidence constraint, and this remains stable in each configuration....
 

stepalibre

Alibre Super User
Regarding the script, each configuration has a different sketch. As you can see, in this case, I hooked the "pilot" sketch to the center, with a coincidence constraint, and this remains stable in each configuration....
I asked because when switching configurations in your file the text figure value in the sketch "Text_Sketch" doesn't change. But I understand.

This should be an addon or a headless mode tool. My solution will run in the background, not through Alibre Script. I am curious about how well Alibre performs using your script on 1000+ items.
 

stepalibre

Alibre Super User
This is basically a labeling, stamping or watermarking procedure. Great timing, I need to build a system for structural steel projects. The text will be in 2D and 3D for 100's to 1'000's of unique pieces.
I forgot to mention an important detail. My solution will include 2D drawings, embossed text and 3d models of tags and nameplates.
 

stepalibre

Alibre Super User
For us non-programmers, what is a "headless mode tool"?
Headless means without a GUI or application windows visible. You use a command line interface to control the application typically from a terminal or windows command prompt.

Pulled from :C:\Program Files\Alibre Design 28.0.1.28098\Alibre Design API Help\AlibreAPIHelp.chm

1720965275475.png

"headless mode tool"
What I mean here is a program that runs in headless mode but as a tool not a CLI program. A tool or you can call it a macro, will simply run the code and exit. You click a button or keyboard shortcut to run it.
 
Last edited:
Thanks for the explanation. All the VB programming I've done for both NX and Solidworks has required user input of some kind. The only cad program I've used that used headless mold was DUCT out of Cambridge England, just didn't know it was called headless mode.
 

Cator

Senior Member
Ho chiesto perché quando si cambiano le impostazioni nel file il valore della figura di testo nello sketch "Text_Sketch" non cambia. Ma capisco.

Potrebbe trattarsi di un componente aggiuntivo o di uno strumento in modalità headless. La mia soluzione verrà eseguita in background, non tramite Alibre Script. Sono curioso di sapere come funziona Alibre utilizzando il tuo script su oltre 1000 elementi.
I updated the script to create new parts with the name selected from the file. I'm trying a 2000 parts column but the support per minute with my PC is around 20 parts per minute. If you were to also create the 2D views and maybe export them to a couple of 3D formats, you would have to 5 6 Matrices per minute. It doesn't seem right to me for what you want to do.

Then of course you can certainly do better but if the problem is only variable 2D text there are other programs made specifically to burn the tachometer... From laser markers to fiber markers, simple programs that mark text variables before nothing ....but that's another story....
 

Attachments

  • Variable Text_En2.zip
    1.7 KB · Views: 2
Top