Generate Barcode based on note content and place it in a fix position in drawing sheet

Generate Barcode based on note content and place it in a fix position in drawing sheet

dparmarF6BDE
Enthusiast Enthusiast
215 Views
3 Replies
Message 1 of 4

Generate Barcode based on note content and place it in a fix position in drawing sheet

dparmarF6BDE
Enthusiast
Enthusiast

Hello all,
I am trying to generate the barcode from a note in the sheet and place the barcode in the top center position in the sheet. I am having issue with ilogic script to do this. Any lead would be appreciated.

Thank you in advance!

dparmarF6BDE_0-1727445564852.png

dparmarF6BDE_1-1727445595915.png

dparmarF6BDE_2-1727445688114.png

 

0 Likes
216 Views
3 Replies
Replies (3)
Message 2 of 4

WCrihfield
Mentor
Mentor

Hi @dparmarF6BDE.  As far as I know, there is no built-in way to generate bar codes of any sort, for placing in drawings.  There may be an add-in or standalone application for something like that in the Autodesk App Store though.  You could search there for something like that.

Below are a couple links I found there, in that category:

https://apps.autodesk.com/INVNTOR/en/Detail/Index?id=6498986275150675602&appLang=en&os=Win64 

https://apps.autodesk.com/ACD/en/Detail/Index?id=6226799495222312553&appLang=en&os=Win32_64 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 4

Curtis_Waguespack
Consultant
Consultant

@dparmarF6BDE 

 

You can use the font called Free 3 of 9 to display your text as a bar code.

It's been about 10 years since I have done this, so forgive me if I state some of this incorrectly... but I think in the past I did this 2 ways (a sketched symbol and a field in the title block), but didn't use any iLogic code to do anything other then fill in an iProperty

 

I think both just read in an iproperty twice, the top line used the barcode font the other was some other font... something like this:

Curtis_Waguespack_1-1727453378530.png

 

 

EESignature

0 Likes
Message 4 of 4

dparmarF6BDE
Enthusiast
Enthusiast

@Curtis_Waguespack 

I found the solution which is to use CODE39 style and add "*" at first and last of the value of my barcode. Now I am trying to find the note in the sheet which has "SKID#: " in the content and if found then  copy the whole content and make a new note where the location of the note is 1" right and 1" down from the top left corner of the sheet and paste the copied content in the new note without "SKID#: " and add * at front and end, then change the note style to "CODE39" as I have it defined in my document which will flip it to barcode. My Ilogic code is not working the way I want it to. Can you please help me fix that?



' iLogic Script for finding the note with "SKID#: ", copying it, and placing it at a new location

' Define the active document as a drawing document
Dim oDoc As DrawingDocument
oDoc = ThisApplication.ActiveDocument

' Get the current drawing sheet
Dim oSheet As Sheet
oSheet = oDoc.ActiveSheet

' Get all the drawing notes on the sheet
Dim oNotes As DrawingNotes
oNotes = oSheet.DrawingNotes

Dim skidNote As DrawingNote = Nothing

' Find the note that contains "SKID#: "
For Each oNote As DrawingNote In oNotes
If oNote.Text.Contains("SKID#: ") Then
skidNote = oNote
Exit For ' Exit loop once the note is found
End If
Next

' If no note containing "SKID#: " was found, show a message
If skidNote Is Nothing Then
MessageBox.Show("No note containing 'SKID#: ' found on the sheet.")
Return
End If

' Get the content of the note
Dim noteContent As String
noteContent = skidNote.Text.Replace("SKID#: ", "")

' Add "*" at the beginning and end of the note content
Dim modifiedNoteContent As String
modifiedNoteContent = "*" & noteContent & "*"

' Define 1 inch down from the top and 1 inch right from the left as the new note position
Dim oTG As TransientGeometry
oTG = ThisApplication.TransientGeometry
Dim newNotePosition As Point2d
newNotePosition = oTG.CreatePoint2d(1, oSheet.Height - 1)

' Create a new drawing note with the same content at the new position
Dim copiedNote As DrawingNote
copiedNote = oSheet.DrawingNotes.Add(newNotePosition, modifiedNoteContent)

' Set the text style to "CODE39" (assuming the style is available)
Dim textStyle As TextStyle
textStyle = oDoc.StylesManager.TextStyles.Item("CODE39")
copiedNote.TextStyle = textStyle

' Align the copied note (optional, based on desired alignment)
copiedNote.HorizontalJustification = HorizontalTextAlignmentEnum.kAlignTextLeft
copiedNote.VerticalJustification = VerticalTextAlignmentEnum.kAlignTextMiddle ' Use middle alignment

MessageBox.Show("Note copied and moved to the new location successfully!")



0 Likes