News:

Please remember to do a search before you ask a question!

Main Menu

Block attribute flags?

Started by nikkipollard, May 03, 2021, 05:23:19 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

nikkipollard

Does anyone know how to add a visible block attribute to a block via the sdk. There is a flag parameter  in the function but I cant find a value for a visible attribute. all the sdk samples have omitted them.
I tried to change the property afterwards but I am getting an error.
Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h

nikkipollard

Never mind typing 0 for the flag parameter  seems to work
Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h

Marek

Hi Nikki
I added attributes in VB according to the method

AddAttributeDefinition (Tag As String, X0 As double, Y0 As double, Z0 As double, Height As double, Angle As Variant, Width As Variant, Offset As Variant, Justification As Variant, AttFlags As Variant, Default As Variant, Prompt As Variant) As IGraphic

Marek
Marek

TC Pro 2016, TC Pro 2018, TC Plat 2019,TC Plat 2020,TC Plat 2021,TC Plat 2022,TC Plat 2023,TC Plat 2024, TC Plat 2025
Laptop Asus i7 6500U, dual-core 2,50GHz, NVIDIA GeForce GTX 950M, RAM 12 GB, SSD 480GB
Windows 10 64 bit

nikkipollard

#3
Thanks Marek I couldn't find the ATT flags - imsiAttFlag values. They don't seem to come up on the intellisense.
But I was able to add them as properties afterwards. I didn't realise that after adding an attribute - you need to re reference the attribute to change the properties. - Like explode.

Tcdraw.Blocks("myblock").AddAttributeDefinition("Level",x1, y1, z1,2*1.6667,,,,
                                                   2049,, "100", "Level")
' you need to dim the variable after adding the attribute - the same as exploding a graphic
Dim att As IMSIGX.Graphic
att = Tcdraw.Blocks("myblock").Graphics(2)
att.Properties.Item("TextFont").Value = "Verdana"
att.Properties.Item("AttInvisible").Value = 1
'other properties
' "AttInvisible"
' "AttPrompt"
' "AttValue"




I eventually gave Up with the attribute idea as I couldn't add new
blocks and change the attribute using the same principle - I kept getting a bad index error.
So I used groups and text instead.
Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h

Marek

I also had problems with changing the attributes. I used the attribute names and then changed their value. I only used flags 0 or 1 (invisible, visible) when creating a block. I am posting a code fragment, I do not know if it will be readable to you. It is in VB Microsoft Studio.
Marek
Marek

TC Pro 2016, TC Pro 2018, TC Plat 2019,TC Plat 2020,TC Plat 2021,TC Plat 2022,TC Plat 2023,TC Plat 2024, TC Plat 2025
Laptop Asus i7 6500U, dual-core 2,50GHz, NVIDIA GeForce GTX 950M, RAM 12 GB, SSD 480GB
Windows 10 64 bit

nikkipollard

#5
Thank you Marek that makes it a lot clearer to me.
I guess if I know the attribute - property name ? I don't need to loop through each property. - I can change it directly
The only part I don't understand - is the top 4 lines - when you are mapping elements.
Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h

Marek

Quote from: nikkipollard on May 05, 2021, 10:59:36 PM
I guess if I know the attribute - property name ? I don't need to loop through each property. - I can change it directly
If I didn't loop through each property, I had trouble reading the attributes. I was fed up with fiddling and left it as it worked for me.
Quote from: nikkipollard on May 05, 2021, 10:59:36 PM
The only part I don't understand - is the top 4 lines - when you are mapping elements.
This is due to the fact that in my program I select an attribute from the drop-down list (then I look for the value by the key). Here I should cut off part of this picture, because for the problem we're talking about, it doesn't matter.

Marek
Marek

TC Pro 2016, TC Pro 2018, TC Plat 2019,TC Plat 2020,TC Plat 2021,TC Plat 2022,TC Plat 2023,TC Plat 2024, TC Plat 2025
Laptop Asus i7 6500U, dual-core 2,50GHz, NVIDIA GeForce GTX 950M, RAM 12 GB, SSD 480GB
Windows 10 64 bit

nikkipollard

#7
Thank You Marek. Your picture solved my problem.
The only reason I didn't want to cycle through all the properties is because it always takes so long for for my computer to cycle through TurboCads' database. -
I do use that trick but I try to exit the loop as soon as soon I have found a match.
Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h

Marek

Quote from: nikkipollard on May 06, 2021, 01:53:26 AM
I do use that trick but I try to exit the loop as soon as soon I have found a match.
It's a good idea.

It is not easy for a layman programing for Turbocad, because there are too few examples and I know too little. I also tried to do something in CSharp, but I didn't do much, I 'm not sure if on a 64-bit system it works good.
Marek
Marek

TC Pro 2016, TC Pro 2018, TC Plat 2019,TC Plat 2020,TC Plat 2021,TC Plat 2022,TC Plat 2023,TC Plat 2024, TC Plat 2025
Laptop Asus i7 6500U, dual-core 2,50GHz, NVIDIA GeForce GTX 950M, RAM 12 GB, SSD 480GB
Windows 10 64 bit

nikkipollard

I am a complete novice at this Marek.

You know so much more then I do.
Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h