Factory Design Utilities Forum
Welcome to Autodesk’s Factory Design Utilities Forums. Share your knowledge, ask questions, and explore popular Factory Design Utilities topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Object reference not set to an instance of an object

4 REPLIES 4
Reply
Message 1 of 5
Logos_Atum
495 Views, 4 Replies

Object reference not set to an instance of an object

Hello there,

 

recently out asset library did get some addons, in order

to use the BIM with some of the company´s custom tools.

 

With some time at hand, I planned to use an Excel table

with all the asset specific data as a base for new assets, as

well as base to add customer specific dimensions in a quick

manner.

 

It´ll not be necessary to change any model data Inventor

wise now, and live links with customer databases can be

established and applied to the assets directly. Changes in

equipment, as well as the dimensions and other metrics,

will be updated too.

 

And with the parametric modelling offered in FDS we should

just do fine. Allocating the right amount of square footage is

crucial, especially in logistics.

 

I encountered a problem, and currently I seem to be stuck in

my tunnel all to much to see.

 

 

Injecting/adding the following code I got an...

 

'creating an userParameter as millimeters

 

oMyParameter=ThisApplication.ActiveDocument.ComponentDefinition.Parameters.UserParameters

oParameter=oMyParameter.AddByExpression("width", "1000", UnitsTypeEnum.kMillimeterLengthUnits)
oParameter=oMyParameter.AddByExpression("height", "1000", UnitsTypeEnum.kMillimeterLengthUnits)

 

'creating an userParameter as text

 

oParameter=oMyParameter.AddByValue("speed", "0", UnitsTypeEnum.kTextUnits)
oParameter=oMyParameter.AddByValue("motors", "0", UnitsTypeEnum.kTextUnits)
oParameter=oMyParameter.AddByValue("ID", "0", UnitsTypeEnum.kTextUnits)
oParameter=oMyParameter.AddByValue("ID_FCC", "0", UnitsTypeEnum.kTextUnits)
oParameter=oMyParameter.AddByValue("ID_PQC", "0", UnitsTypeEnum.kTextUnits)
oParameter=oMyParameter.AddByValue("ID_OWC", "0", UnitsTypeEnum.kTextUnits)
oParameter=oMyParameter.AddByValue("ID_WC", "0", UnitsTypeEnum.kTextUnits)
oParameter=oMyParameter.AddByValue("ID_B", "0", UnitsTypeEnum.kTextUnits)
oParameter=oMyParameter.AddByValue("ID_LUA", "0", UnitsTypeEnum.kTextUnits)
oParameter=oMyParameter.AddByValue("ID_IO", "0", UnitsTypeEnum.kTextUnits)
oParameter=oMyParameter.AddByValue("ID_CSS", "0", UnitsTypeEnum.kTextUnits)
oParameter=oMyParameter.AddByValue("ID_MAS", "0", UnitsTypeEnum.kTextUnits)
oParameter=oMyParameter.AddByValue("ID_SD", "0", UnitsTypeEnum.kTextUnits)

 

'Setting Parameter values by an excel source file


GoExcel.Open("d:\FDS20.xls", "Sheet1")

 

MultiValue.List("width") = GoExcel.CellValues("d:\FDS20.xls", "Sheet1", "L1", "O1")
MultiValue.List("speed") = GoExcel.CellValues("d:\FDS20.xls", "Sheet1", "R1", "Y1")
MultiValue.List("motors") = GoExcel.CellValues("d:\FDS20.xls", "Sheet1", "Z1", "AB1")

MultiValue.List("ID") = GoExcel.CellValues("d:\FDS20.xls", "Sheet1", "E1", "G1")
MultiValue.List("ID_FCC") = GoExcel.CellValues("d:\FDS20.xls", "Sheet1", "AC1", "AE1")
MultiValue.List("ID_PQC") = GoExcel.CellValues("d:\FDS20.xls", "Sheet1", "AF1", "AH1")
MultiValue.List("ID_OWC") = GoExcel.CellValues("d:\FDS20.xls", "Sheet1", "AI1", "AK1")
MultiValue.List("ID_WC") = GoExcel.CellValues("d:\FDS20.xls", "Sheet1", "AL1", "AN1")
MultiValue.List("ID_B") = GoExcel.CellValues("d:\FDS20.xls", "Sheet1", "AO1", "AQ1")
MultiValue.List("ID_LUA") = GoExcel.CellValues("d:\FDS20.xls", "Sheet1", "AR1", "AT1")
MultiValue.List("ID_IO") = GoExcel.CellValues("d:\FDS20.xls", "Sheet1", "AU1", "AW1")
MultiValue.List("ID_CSS") = GoExcel.CellValues("d:\FDS20.xls", "Sheet1", "AX1", "AZ1")
MultiValue.List("ID_MAS") = GoExcel.CellValues("d:\FDS20.xls", "Sheet1", "BA1", "BC1")
MultiValue.List("ID_SD") = GoExcel.CellValues("d:\FDS20.xls", "Sheet1", "BD1", "BF1")

 

'limiting parameter values 

 

If height < 450 then height = 450

 

 

"Object reference not set to an instance of an object"

 error message that terminates the publish operation.

 

I tested a variety of the following:

 

  • looked for units conflicting geometry
  • delete rule after it ran
  • add custom values for multi text Parameters
  • empty values assigned - rebuild
  • iproperty mass

 

Added:

 

  • InventorVb.CheckParameters("")
  • Parameter.Quiet = True
  • InventorVb.DocumentUpdate()
  • ThisDoc.Save

 

Without any errors returned, still Publishing is canceled

 

I´t be great if it´d be possible to help me a bit.

 

 

Kind regards

 

 

Daniel

Dogs aren´t flammable.
4 REPLIES 4
Message 2 of 5
yizhou.cao
in reply to: Logos_Atum

Hi Daniel,

 

I am not following. Is your code in a logic rule? Can you attach the part you are trying to publish, as well as the spreadsheet?

 

Thanks,

 

Yizhou C
Autodesk Factory Design team

Message 3 of 5
XuesongBai
in reply to: Logos_Atum

Hello Daniel,

 

Good to hear you again.

The asset linked to Excel is not supported right now.

Could you please post the idea in the Factory IdeaStation?

  • Why you are doing?
  • What benefit from what you are doing now?

 

Thanks,

-Xuesong

Please mark as a solution if somehow I got it right.
Message 4 of 5
Logos_Atum
in reply to: yizhou.cao

Hello yizhou,

 

it is a rule, yes.

 

And it is deleted right after it ran once. Still the publish

fails, even if it´s simply a cube, with some Parameters ad-

ded

 

Kind regards

 

Daniel

 

 

Dogs aren´t flammable.
Message 5 of 5
Logos_Atum
in reply to: XuesongBai

Hello Xuesong

 

Long time not read, yes 🙂 I´ll post it to the idea station,

in a minute.

 

Removing the script after the parameters were created,

did not settle the issue though.

 

I did attach a helper object.

 

 

Kind regards

 

Daniel

Dogs aren´t flammable.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report